@hackbuild/ai-views 0.1.0 → 0.1.2

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.
@@ -3872,7 +3872,7 @@ function ladderFor(rec, env) {
3872
3872
  skipped
3873
3873
  };
3874
3874
  }
3875
- /** The onnxruntime-web ladder the earlier transcription tool walks after one fetch: webgpu at basic, all, disabled, then wasm. */
3875
+ /** The onnxruntime-web ladder to walk after one fetch: webgpu at basic, all, disabled, then wasm. */
3876
3876
  function ortLadder() {
3877
3877
  return [
3878
3878
  {
@@ -3906,6 +3906,7 @@ function ortLadder() {
3906
3906
  ];
3907
3907
  }
3908
3908
  // packages/models/src/pins.ts
3909
+ /** Pinned commits and file hashes per Hugging Face repo, written by tools/pin-weights.mjs. */
3909
3910
  const PINS = {
3910
3911
  "HuggingFaceTB/SmolLM2-135M-Instruct": {
3911
3912
  "revision": "12fd25f77366fa6b3b4b768ec3050bf629380bac",
@@ -6754,6 +6755,7 @@ const PINS = {
6754
6755
  * added to a registry, so every loader resolves `resolve/<commit>/` URLs,
6755
6756
  * and pinnedSha gives the SHA-256 for such a URL.
6756
6757
  */
6758
+ /** The pin of a repo, or undefined when the repo is not pinned. */
6757
6759
  function pinOf(repo) {
6758
6760
  return repo && Object.hasOwn(PINS, repo) ? PINS[repo] : void 0;
6759
6761
  }
@@ -6763,15 +6765,15 @@ function pinnedBase(repo, fallback = "main") {
6763
6765
  }
6764
6766
  // packages/models/src/catalog.ts
6765
6767
  /**
6766
- * Starter records. Sizes marked "inferred" come from the builds' tables or
6768
+ * Starter records. Sizes marked "inferred" come from published tables or
6767
6769
  * from parameter count times bits and are not measured downloads. Chat rows
6768
6770
  * marked "measured" sum the Content-Length of a HEAD request on every file
6769
6771
  * the runtime loads, at the repo head of 2026-11-24, in MiB; no weight was
6770
6772
  * downloaded. WebLLM rows count the Hugging Face repo and leave out the
6771
6773
  * model library wasm, which comes from another host. Licences on the older rows are the ones on each model card as
6772
6774
  * of 2026-11-22; on the chat rows added 2026-11-24 they are the model card
6773
- * licence field the Hugging Face API returns, or the design harvest's
6774
- * string, and were not checked (owner decision). Recheck before shipping a
6775
+ * licence field the Hugging Face API returns, or a recorded string, and
6776
+ * were not checked (owner decision). Recheck before shipping a
6775
6777
  * product on them. Add your own records with registry.add().
6776
6778
  *
6777
6779
  * vramMB marked "computed" on the 14 WebLLM rows added 2026-11-25 is the
@@ -6780,13 +6782,13 @@ function pinnedBase(repo, fallback = "main") {
6780
6782
  * Rows with sizeSource "vendor" added 2026-11-25 sum the file sizes of the
6781
6783
  * Hugging Face listing of the repo (no download), converted to MiB.
6782
6784
  * Every row carries a speed word and a verdict of one to four words: what
6783
- * a person picks by, in the owner's voice, as the earlier tools wrote them.
6785
+ * a person picks by, in the owner's voice.
6784
6786
  *
6785
6787
  * Catalogue facts (params, quant, VRAM, censorship, tags, note) are copied
6786
- * from the owners' tool labels and the WebLLM catalogue as recorded in the
6787
- * design harvest; VRAM figures are the catalogue's own (vendor). Licence
6788
+ * from the owner's model labels and the WebLLM catalogue; VRAM figures are the catalogue's own (vendor). Licence
6788
6789
  * strings are shown as recorded and were not verified for these facts.
6789
6790
  */
6791
+ /** The starter model records, each with its size source and weight licence. */
6790
6792
  const CATALOG = [
6791
6793
  {
6792
6794
  id: "smollm2-135m-instruct",
@@ -7342,7 +7344,7 @@ const CATALOG = [
7342
7344
  tier: "large",
7343
7345
  family: "gemma",
7344
7346
  tags: [],
7345
- note: "an uncensored gemma 4 brain. the earlier clone chat's default; it warns with no webgpu.",
7347
+ note: "an uncensored gemma 4 brain. it warns with no webgpu.",
7346
7348
  group: "uncensored",
7347
7349
  badge: "best",
7348
7350
  speed: "slow",
@@ -7376,7 +7378,7 @@ const CATALOG = [
7376
7378
  tier: "medium",
7377
7379
  family: "gemma",
7378
7380
  tags: [],
7379
- note: "lighter gemma 4. the earlier room's default with webgpu.",
7381
+ note: "lighter gemma 4. a chat default with webgpu.",
7380
7382
  group: "uncensored",
7381
7383
  badge: "lighter",
7382
7384
  speed: "steady",
@@ -7552,7 +7554,7 @@ const CATALOG = [
7552
7554
  tier: "small",
7553
7555
  family: "qwen3.5",
7554
7556
  tags: ["no gpu"],
7555
- note: "the earlier room's default with no webgpu. thin for long chats.",
7557
+ note: "a chat default with no webgpu. thin for long chats.",
7556
7558
  group: "uncensored",
7557
7559
  badge: "faster",
7558
7560
  speed: "fast",
@@ -7684,7 +7686,7 @@ const CATALOG = [
7684
7686
  tier: "small",
7685
7687
  family: "qwen3",
7686
7688
  tags: ["think"],
7687
- note: "a small qwen3 with a think trace. an earlier room's deliberator.",
7689
+ note: "a small qwen3 with a think trace. fits a deliberator role.",
7688
7690
  group: "reasoning",
7689
7691
  badge: "think, easier on memory",
7690
7692
  speed: "fast",
@@ -8354,25 +8356,25 @@ function tjsLadder(spec) {
8354
8356
  }
8355
8357
  return spec.wasmFirst ? [...cpu, ...gpu] : [...gpu, ...cpu];
8356
8358
  }
8357
- /** onnxruntime-web rungs: the earlier transcription tool walk, or wasm only when the graph is known to fail on webgpu. */
8359
+ /** onnxruntime-web rungs: webgpu then wasm, or wasm only when the graph is known to fail on webgpu. */
8358
8360
  function ortRungs(opts = {}) {
8359
8361
  const all = ortLadder();
8360
8362
  return opts.webgpu === false ? all.filter((r) => r.device === "wasm") : all;
8361
8363
  }
8362
- /** Ladders by name, from the builds. Each model record may copy one or write its own. */
8364
+ /** Ladders by name, one per model family. Each model record may copy one or write its own. */
8363
8365
  const LADDERS = {
8364
- /** an earlier relief bench runDepth. */
8366
+ /** Depth: fp16 then fp32 on webgpu, q8 then fp32 on wasm. */
8365
8367
  depth: () => tjsLadder({
8366
8368
  webgpu: ["fp16", "fp32"],
8367
8369
  wasm: ["q8", "fp32"]
8368
8370
  }),
8369
- /** earlier builds: perception models on cpu by default. */
8371
+ /** Perception models on cpu by default. */
8370
8372
  perceptionCpu: () => tjsLadder({
8371
8373
  webgpu: ["fp32"],
8372
8374
  wasm: ["q8", "fp32"],
8373
8375
  wasmFirst: true
8374
8376
  }),
8375
- /** whisper-large-v3-turbo (weights MIT), as the earlier transcription tool ran it. */
8377
+ /** whisper-large-v3-turbo (weights MIT). */
8376
8378
  whisperTurbo: () => tjsLadder({
8377
8379
  webgpu: [{
8378
8380
  encoder_model: "fp16",
@@ -8397,7 +8399,7 @@ const LADDERS = {
8397
8399
  decoder_model_merged: "q8"
8398
8400
  }]
8399
8401
  }),
8400
- /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm, as earlier builds ran it. */
8402
+ /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm. */
8401
8403
  smolvlm: () => tjsLadder({
8402
8404
  webgpu: [{
8403
8405
  embed_tokens: "fp32",
@@ -8415,7 +8417,7 @@ const LADDERS = {
8415
8417
  }],
8416
8418
  freshHeapRetry: true
8417
8419
  }),
8418
- /** earlier builds: q4f16 on webgpu only. */
8420
+ /** q4f16 on webgpu only. */
8419
8421
  vlmGpuOnly: () => tjsLadder({ webgpu: ["q4f16", "q4"] }),
8420
8422
  ort: ortRungs
8421
8423
  };
@@ -8424,6 +8426,7 @@ const LADDERS = {
8424
8426
  * Embedder records for the models hub. Sizes are inferred from the model
8425
8427
  * repos' file lists; licences are the model cards' as of 2026-11-22.
8426
8428
  */
8429
+ /** Hub records for potion-base-8M, all-MiniLM-L6-v2 and bge-small-en-v1.5. */
8427
8430
  const EMBED_RECORDS = [
8428
8431
  {
8429
8432
  id: "potion-base-8m",
@@ -8443,7 +8446,7 @@ const EMBED_RECORDS = [
8443
8446
  licence: "MIT",
8444
8447
  commercial: true,
8445
8448
  place: "main",
8446
- notes: ["256 dims, no runtime, about 0.08 ms per sentence in an earlier build (measured there, not here)", "misses paraphrase"]
8449
+ notes: ["256 dims, no runtime, about 0.08 ms per sentence (measured outside this repository)", "misses paraphrase"]
8447
8450
  },
8448
8451
  {
8449
8452
  id: "minilm-l6",
@@ -8465,7 +8468,7 @@ const EMBED_RECORDS = [
8465
8468
  commercial: true,
8466
8469
  place: "cpu-worker",
8467
8470
  runtime: "@huggingface/transformers@4.3.2",
8468
- notes: ["384 dims; webgpu with q8 garbled other models in earlier builds, so q8 stays on wasm"]
8471
+ notes: ["384 dims; webgpu with q8 garbled other models, so q8 stays on wasm"]
8469
8472
  },
8470
8473
  {
8471
8474
  id: "bge-small-en",
@@ -8511,6 +8514,7 @@ const free512 = { freeDimensionOverrides: {
8511
8514
  height_latent: 64,
8512
8515
  width_latent: 64
8513
8516
  } };
8517
+ /** The image models {@link attachImagegen} registers: SD-Turbo and SD 1.5, each with its licence, size and form. */
8514
8518
  const IMAGEGEN_RECORDS = [{
8515
8519
  id: "sd-turbo",
8516
8520
  label: "sd-turbo 512",
@@ -8535,9 +8539,9 @@ const IMAGEGEN_RECORDS = [{
8535
8539
  place: "gpu",
8536
8540
  runtime: "onnxruntime-web@1.27.0",
8537
8541
  notes: [
8538
- "webgpu only in an earlier build, no wasm floor",
8542
+ "webgpu only, no wasm floor",
8539
8543
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)",
8540
- "graph file paths inferred from an earlier build, not checked against the repo"
8544
+ "graph file paths inferred, not checked against the repo"
8541
8545
  ],
8542
8546
  form: {
8543
8547
  steps: {
@@ -8577,7 +8581,7 @@ const IMAGEGEN_RECORDS = [{
8577
8581
  place: "gpu",
8578
8582
  runtime: "onnxruntime-web@1.27.0",
8579
8583
  notes: [
8580
- "about 2 GB by an earlier bench's label (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
8584
+ "about 2 GB (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
8581
8585
  "runs the unet twice a step for guidance, so a step costs about twice an sd-turbo step (inferred)",
8582
8586
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)"
8583
8587
  ],
@@ -8634,7 +8638,7 @@ const IMAGEGEN_PICKER_RECORDS = [{
8634
8638
  commercial: "unknown",
8635
8639
  place: "gpu",
8636
8640
  runtime: "onnxruntime-web@1.27.0",
8637
- notes: ["two text encoders; the pipeline in this package runs one, so this record is listed and not run yet", "an earlier image bench offered it as the highest quality of three"],
8641
+ notes: ["two text encoders; the pipeline in this package runs one, so this record is listed and not run yet", "the highest quality of the three image models"],
8638
8642
  form: {
8639
8643
  steps: {
8640
8644
  min: 1,
@@ -8651,6 +8655,7 @@ const IMAGEGEN_PICKER_RECORDS = [{
8651
8655
  }
8652
8656
  }];
8653
8657
  // packages/speak/src/records.ts
8658
+ /** Model records for the voices this package drives, for pickers and the models registry. */
8654
8659
  const SPEAK_RECORDS = [
8655
8660
  {
8656
8661
  id: "kokoro-82m",
@@ -8675,7 +8680,7 @@ const SPEAK_RECORDS = [
8675
8680
  commercial: true,
8676
8681
  place: "cpu-worker",
8677
8682
  runtime: "kokoro-js@1.2.1",
8678
- notes: ["webgpu with q8 gave garbled audio in an earlier build", "fp32 weights (about 330 MB, inferred) do not cache on file://, so webgpu needs http"]
8683
+ notes: ["webgpu with q8 has given garbled audio", "fp32 weights (about 330 MB, inferred) do not cache on file://, so webgpu needs http"]
8679
8684
  },
8680
8685
  {
8681
8686
  id: "pocket-tts",
@@ -8743,8 +8748,7 @@ const SPEAK_RECORDS = [
8743
8748
  // packages/transcribe/src/records.ts
8744
8749
  /**
8745
8750
  * Speech to text records for the models hub. Ladders and dtypes are
8746
- * the earlier transcription tool's per model table; sizes are inferred from the builds'
8747
- * notes, except rows marked vendor: those sum the quantized encoder and
8751
+ * one per model table; sizes are inferred from the model notes, except rows marked vendor: those sum the quantized encoder and
8748
8752
  * decoder in the hub listing (no download, 2026-11-25), in MiB. Licences are the model cards' as of 2026-11-22.
8749
8753
  */
8750
8754
  const asr = (r) => ({
@@ -8756,6 +8760,7 @@ const asr = (r) => ({
8756
8760
  runtime: "@huggingface/transformers@4.3.2",
8757
8761
  ...r
8758
8762
  });
8763
+ /** The Whisper and Moonshine model records for the models hub. */
8759
8764
  const TRANSCRIBE_RECORDS = [
8760
8765
  asr({
8761
8766
  id: "whisper-large-v3-turbo",
@@ -8769,7 +8774,7 @@ const TRANSCRIBE_RECORDS = [
8769
8774
  ladder: LADDERS.whisperTurbo(),
8770
8775
  licence: "MIT",
8771
8776
  place: "gpu",
8772
- notes: ["best accuracy, multilingual, wants webgpu (as earlier builds did)", "download per rung: 1.5 gb fp16 encoder and q4 decoder, 2.7 gb fp32 encoder, 1.0 gb q8 on wasm (vendor)"]
8777
+ notes: ["best accuracy, multilingual, wants webgpu", "download per rung: 1.5 gb fp16 encoder and q4 decoder, 2.7 gb fp32 encoder, 1.0 gb q8 on wasm (vendor)"]
8773
8778
  }),
8774
8779
  asr({
8775
8780
  id: "whisper-base",
@@ -8806,7 +8811,7 @@ const TRANSCRIBE_RECORDS = [
8806
8811
  sizeMB: 90,
8807
8812
  ladder: LADDERS.whisperSmall(false),
8808
8813
  licence: "MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0)",
8809
- notes: ["english only; the earlier transcription tool's no gpu default"]
8814
+ notes: ["english only; the default with no gpu"]
8810
8815
  }),
8811
8816
  asr({
8812
8817
  id: "whisper-tiny.en",
@@ -8855,6 +8860,7 @@ const TRANSCRIBE_RECORDS = [
8855
8860
  * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
8856
8861
  * swap set sit in PICKER_RECORDS.
8857
8862
  */
8863
+ /** The MediaPipe model storage base URL the MediaPipe records load from. */
8858
8864
  const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
8859
8865
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
8860
8866
  const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
@@ -8875,6 +8881,7 @@ const mp = (id, provides, path, sizeMB, label, verdict = "light, on the gpu", gr
8875
8881
  place: "main",
8876
8882
  runtime: "@mediapipe/tasks-vision@1.2.3"
8877
8883
  });
8884
+ /** The vision records registered by `attachVision`: Depth Anything V2 small, MediaPipe detection, segmentation and landmarks, SlimSAM, SmolVLM 256M and LFM2-VL 450M. */
8878
8885
  const VISION_RECORDS = [
8879
8886
  {
8880
8887
  id: "depth-anything-v2-small",
@@ -8892,7 +8899,7 @@ const VISION_RECORDS = [
8892
8899
  commercial: true,
8893
8900
  place: "cpu-worker",
8894
8901
  runtime: "@huggingface/transformers@4.3.2",
8895
- notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"]
8902
+ notes: ["fp16 on webgpu, fp32 on the same device after a failure"]
8896
8903
  },
8897
8904
  mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
8898
8905
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
@@ -8924,7 +8931,7 @@ const VISION_RECORDS = [
8924
8931
  commercial: true,
8925
8932
  place: "cpu-worker",
8926
8933
  runtime: "@huggingface/transformers@4.3.2",
8927
- notes: ["earlier builds: one image embedding, then any number of point prompts"]
8934
+ notes: ["one image embedding, then any number of point prompts"]
8928
8935
  },
8929
8936
  {
8930
8937
  id: "smolvlm-256m-instruct",
@@ -8967,13 +8974,12 @@ const VISION_RECORDS = [
8967
8974
  commercial: "unknown",
8968
8975
  place: "gpu",
8969
8976
  runtime: "@huggingface/transformers@4.3.2",
8970
- notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
8977
+ notes: ["q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
8971
8978
  }
8972
8979
  ];
8973
8980
  /**
8974
8981
  * Records listed for pickers and never registered by default, so a hub's
8975
- * routing by capability keeps its small defaults: larger alternates the
8976
- * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
8982
+ * routing by capability keeps its small defaults: larger alternates (smolvlm 500m and 2 video, gemma 4 e2b, two more
8977
8983
  * depth models), and records under licences that limit use (YOLOv10 and
8978
8984
  * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
8979
8985
  * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
@@ -9007,8 +9013,9 @@ const yolo10 = (size, mb, speed, verdict) => ({
9007
9013
  licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
9008
9014
  commercial: false,
9009
9015
  place: "gpu",
9010
- notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "an earlier room offered nano, small and medium"]
9016
+ notes: ["output [1, 300, 6] after the model's own selection, so no nms pass (vendor, the yolov10 paper)", "comes in nano, small and medium"]
9011
9017
  });
9018
+ /** Records listed for pickers and never registered by default: larger alternates, and records under licences that limit use (YOLOv10, FastSAM, the face swap set). */
9012
9019
  const PICKER_RECORDS = [
9013
9020
  {
9014
9021
  id: "smolvlm-500m-instruct",
@@ -9051,7 +9058,7 @@ const PICKER_RECORDS = [
9051
9058
  commercial: true,
9052
9059
  place: "cpu-worker",
9053
9060
  runtime: "@huggingface/transformers@4.3.2",
9054
- notes: ["an earlier room offered it beside smolvlm 256m and 500m"]
9061
+ notes: ["an option beside smolvlm 256m and 500m"]
9055
9062
  },
9056
9063
  {
9057
9064
  id: "depth-anything-v2-base",
@@ -9108,7 +9115,7 @@ const PICKER_RECORDS = [
9108
9115
  commercial: true,
9109
9116
  place: "gpu",
9110
9117
  runtime: "@huggingface/transformers@4.3.2",
9111
- notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"]
9118
+ notes: ["about 3.3 GB (vendor)"]
9112
9119
  },
9113
9120
  yolo10("n", 9, "instant", "nano, quick"),
9114
9121
  yolo10("s", 28, "fast", "small, sharper"),
@@ -9137,7 +9144,7 @@ const PICKER_RECORDS = [
9137
9144
  licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
9138
9145
  commercial: false,
9139
9146
  place: "cpu-worker",
9140
- notes: ["an earlier mask tool found every mask in one pass on onnxruntime-web (93 MB there, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
9147
+ notes: ["finds every mask in one pass on onnxruntime-web (93 MB, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
9141
9148
  },
9142
9149
  {
9143
9150
  id: "scrfd-10g",
@@ -9210,7 +9217,7 @@ const PICKER_RECORDS = [
9210
9217
  licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
9211
9218
  commercial: false,
9212
9219
  place: "gpu",
9213
- notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"]
9220
+ notes: ["128 px faces; paste the result back with a feathered mask"]
9214
9221
  }
9215
9222
  ];
9216
9223
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
@@ -9239,9 +9246,10 @@ function faceApiRecord(baseUrl) {
9239
9246
  * records come from the packages that run them; a record listed in more
9240
9247
  * than one place counts once, the running package's copy first.
9241
9248
  */
9242
- /** face-api weights (MIT) as an earlier face swap tool loaded them, from the package CDN. */
9249
+ /** Base URL of the face-api weights (MIT) on the package CDN. */
9243
9250
  const FACE_API_BASE = "https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.12/model/";
9244
9251
  const has = (...want) => (caps) => caps.some((c) => want.includes(c));
9252
+ /** The words and capability test of every job. */
9245
9253
  const JOBS = {
9246
9254
  chat: {
9247
9255
  label: "brain",
@@ -9350,9 +9358,11 @@ const GROUPS = {
9350
9358
  "no download": "none",
9351
9359
  own: "own"
9352
9360
  };
9361
+ /** Whether a record has nothing to download: a built in, system or zero size model. */
9353
9362
  function isNoDownload(r) {
9354
9363
  return !!r.noDownload || r.sizeMB === 0 || r.provider === "prompt-api" || r.provider === "system";
9355
9364
  }
9365
+ /** Whether a record's censorship is "uncensored" or "abliterated". */
9356
9366
  function isUncensored(r) {
9357
9367
  return r.censorship === "uncensored" || r.censorship === "abliterated";
9358
9368
  }
@@ -9585,6 +9595,7 @@ function defaultPick(records, env, estimate) {
9585
9595
  }).unfit === void 0);
9586
9596
  return (fits.find((r) => r.group === "start here") ?? fits.find((r) => r.speed === "fast" || r.speed === "steady") ?? fits[0] ?? records[0])?.id ?? "";
9587
9597
  }
9598
+ /** Creates a model picker for a job, with rows that say whether each model fits this machine. */
9588
9599
  function useModelPick(job, o = {}) {
9589
9600
  const def = JOBS[job];
9590
9601
  let records = jobRecords(job, o.records ?? ALL_RECORDS);
@@ -9839,9 +9850,29 @@ function pickSheet(pick) {
9839
9850
  }
9840
9851
  };
9841
9852
  }
9853
+ const FILLER = /^(instruct|chat|it|mlc|onnx|gguf|hf|q\d\w*|f16|f32|fp16|int8|bf16|uniform)$/i;
9854
+ /**
9855
+ * A model name cut for the bar chip: filler words (instruct, chat, quant tags)
9856
+ * go, and a name of more than three words keeps its first two and its last,
9857
+ * which is usually the size: "hermes 3 llama 3.2 3b" reads "hermes 3 3b".
9858
+ * A note in brackets goes first: "slimsam 77 uniform (point prompts)" reads "slimsam 77".
9859
+ */
9860
+ function shortName(name) {
9861
+ const w = name.replace(/\s*\([^)]*\)/g, "").split(/\s+/).filter((x) => x && !FILLER.test(x));
9862
+ return (w.length > 3 ? [
9863
+ w[0],
9864
+ w[1],
9865
+ w[w.length - 1]
9866
+ ] : w).join(" ") || name;
9867
+ }
9868
+ /** The chip's words: the short name, then the download size, or the state once it moves. */
9842
9869
  function chipWords(s) {
9843
- const w = $r(s.row, s.empty);
9844
- return w.state ? `${w.name}, ${w.state}` : w.name;
9870
+ const r = s.row;
9871
+ if (!r) return s.empty;
9872
+ const w = $r(r, s.empty);
9873
+ const name = shortName(r.name);
9874
+ if ((r.state === "loading" || r.state === "loaded" || r.state === "error") && w.state) return `${name}, ${w.state}`;
9875
+ return `${name}, ${r.noDownload ? "no download" : r.size ?? "size unknown"}`;
9845
9876
  }
9846
9877
  /** The closed picker over a host; pressing it opens the sheet. */
9847
9878
  function mountModelSelect(host, pick, o = {}) {
@@ -9851,7 +9882,8 @@ function mountModelSelect(host, pick, o = {}) {
9851
9882
  if (o.variant === "chip") {
9852
9883
  const draw = (s) => {
9853
9884
  const words = chipWords(s);
9854
- host.innerHTML = `<button type="button" class="hb-msel-chip${s.row?.state ? ` is-${s.row.state}` : ""}" aria-haspopup="dialog" aria-label="model: ${esc(words)}"><span>${esc(words)}</span></button>`;
9885
+ const full = s.row ? `model: ${s.row.name}${s.row.size ? `, ${s.row.size}` : ""}${$r(s.row, s.empty).state ? `, ${$r(s.row, s.empty).state}` : ""}` : `model: ${s.empty}`;
9886
+ host.innerHTML = `<button type="button" class="hb-msel-chip${s.row?.state ? ` is-${s.row.state}` : ""}" aria-haspopup="dialog" aria-label="${esc(full)}" title="${esc(full)}"><span>${esc(words)}</span></button>`;
9855
9887
  };
9856
9888
  l.on(host, "click", (e) => {
9857
9889
  if (e.target.closest(".hb-msel-chip")) sheet.open();
@@ -9930,13 +9962,14 @@ function contextSegments(s, system = "") {
9930
9962
  }
9931
9963
  // packages/ai-views/src/mount-chat.ts
9932
9964
  /**
9933
- * ChatPane and Composer in the DOM, after the earlier chat tools: the
9965
+ * ChatPane and Composer in the DOM: the
9934
9966
  * thread as hackbuild-ui messages, the reasoning in a fold that is open
9935
9967
  * while it streams, the memory a reply used in a fold under it, copy and
9936
9968
  * redo on the last reply only, and a composer whose send is the one pink
9937
9969
  * action and turns into stop while a reply streams.
9938
9970
  */
9939
9971
  const paras = (t) => t.split(/\n{2,}/).map((p) => p.trim()).filter(Boolean).map((p) => `<div class="hb-msg-text">${esc(p).replace(/\n/g, "<br>")}</div>`).join("");
9972
+ /** The HTML of one chat turn, with its reasoning fold, memory used and stats. */
9940
9973
  function turnHtml(t, o) {
9941
9974
  if (t.role === "user") return `<div class="hb-msg is-user" data-turn="${t.id}"><span class="hb-msg-who"><span class="hb-msg-name">you</span></span><div class="hb-msg-parts">${paras(t.text)}</div></div>`;
9942
9975
  const live = !t.done;
@@ -10075,11 +10108,11 @@ function mountContextMeter(host, thread, o = {}) {
10075
10108
  }
10076
10109
  // packages/ai-views/src/mount-transcribe.ts
10077
10110
  /**
10078
- * TranscribeDrop, TranscriptView and their rack parts in the DOM, after the
10079
- * earlier transcription tool: the drop zone is the page until a file is in
10111
+ * TranscribeDrop, TranscriptView and their rack parts in the DOM: the drop zone is the page until a file is in
10080
10112
  * it, then the transcript is. Lines carry their time, edit in place (one
10081
10113
  * undo step each), and export as txt, srt, vtt and json once there is text.
10082
10114
  */
10115
+ /** The HTML of one channel's transcript, or an empty note when there is none. */
10083
10116
  function transcriptHtml(c, o = {}) {
10084
10117
  if (!c) return `<p class="hb-lay-empty-note">nothing yet. drop a file.</p>`;
10085
10118
  const st = di(c.status);
@@ -10236,7 +10269,7 @@ function mountTranscriptExports(host, queue, o = {}) {
10236
10269
  }
10237
10270
  // packages/ai-views/src/mount-mask.ts
10238
10271
  /**
10239
- * MaskStudio, after the earlier mask studio: drop an image, press a thing
10272
+ * MaskStudio: drop an image, press a thing
10240
10273
  * to cut it out (a click segment model such as SlimSAM), fix the mask by
10241
10274
  * hand with the wand, brush and lasso of hackbuild-ui maskEditor (x swaps
10242
10275
  * add and erase, [ and ] size the brush, ctrl z undoes), zoom and fit, and
@@ -10280,6 +10313,10 @@ function thumbOf(img) {
10280
10313
  t.getContext("2d")?.drawImage(c, 0, 0, t.width, t.height);
10281
10314
  return t.toDataURL("image/png");
10282
10315
  }
10316
+ /**
10317
+ * Mounts a mask studio on a host: drop or open an image, then cut masks with the point, wand, brush
10318
+ * and lasso tools or a segment model.
10319
+ */
10283
10320
  function mountMaskStudio(host, o = {}) {
10284
10321
  let models = o.models ?? {};
10285
10322
  const l = listeners();
@@ -10631,6 +10668,7 @@ function mountMaskRack(host, studio, part, o = {}) {
10631
10668
  // packages/ai-views/src/memory.ts
10632
10669
  const n3 = (x) => Number.isFinite(x) ? x.toFixed(3) : "none";
10633
10670
  const rank = (r) => r >= 0 ? `#${r + 1}` : "none";
10671
+ /** The rows of a recall trace as text, marking the hits handed to the model. */
10634
10672
  function traceRows(r, maxText = 80) {
10635
10673
  const used = new Set(r.hits.map((h) => h.item.id));
10636
10674
  return r.trace.map((t, i) => ({
@@ -10645,11 +10683,13 @@ function traceRows(r, maxText = 80) {
10645
10683
  used: used.has(t.id)
10646
10684
  }));
10647
10685
  }
10686
+ /** The HTML of a recall trace table, or an empty note before any recall. */
10648
10687
  function inspectorHtml(rec) {
10649
10688
  if (!rec) return `<p class="hb-lay-empty-note">no recall yet. ask something to see what memory finds.</p>`;
10650
10689
  const rows = traceRows(rec);
10651
10690
  return `<p class="hb-lay-empty-note" role="status">"${esc(rec.query)}", ${esc(rec.mode)} recall, ${rows.length} found, ${rows.filter((x) => x.used).length} used.</p><div class="hb-scroll-x" data-ux="detail"><table class="hb-table"><thead><tr><th class="num">#</th><th>kind</th><th>text</th><th>bm25</th><th>cosine</th><th class="num">rrf</th><th class="num">score</th></tr></thead><tbody>` + rows.map((x) => `<tr class="${x.used ? "is-mark" : ""}" data-used="${x.used}"><td class="num">${x.rank}</td><td>${esc(x.kind)}</td><td>${esc(x.text)}</td><td>${esc(x.bm25)}</td><td>${esc(x.cos)}</td><td class="num">${x.rrf}</td><td class="num">${x.score}</td></tr>`).join("") + `</tbody></table></div>`;
10652
10691
  }
10692
+ /** Shows a recall trace as a table on a host. */
10653
10693
  function mountMemoryInspector(host, rec = null) {
10654
10694
  host.innerHTML = inspectorHtml(rec);
10655
10695
  return {
@@ -10705,7 +10745,7 @@ function labelColour(label, palette) {
10705
10745
  }
10706
10746
  // packages/ai-views/src/mount-frame.ts
10707
10747
  /**
10708
- * FrameView and CameraFeed, after the eyes view of an earlier room: a
10748
+ * FrameView and CameraFeed: a
10709
10749
  * frame in a hackbuild-ui camera tile with what the models found drawn
10710
10750
  * over it (boxes with their word and score, landmark points and lines),
10711
10751
  * a count in the corner and the caption under it. CameraFeed opens the
@@ -10718,6 +10758,7 @@ const css = (el, name, fb) => {
10718
10758
  return fb;
10719
10759
  }
10720
10760
  };
10761
+ /** Draws a frame in a camera tile on a host, with boxes, landmarks, a corner tag and a caption over it. */
10721
10762
  function mountFrameView(host, o = {}) {
10722
10763
  host.innerHTML = `<div class="hb-frameview"><figure class="hb-camtile" aria-label="frame"><div class="hb-camtile-none" role="status">${esc(o.empty ?? "no frame yet")}</div><canvas aria-hidden="true"></canvas><span class="hb-camtile-tag is-tl" hidden></span></figure><p class="hb-frameview-cap" data-caption aria-live="polite" hidden></p></div>`;
10723
10764
  const fig = host.querySelector("figure");
@@ -10873,6 +10914,7 @@ function mountFrameView(host, o = {}) {
10873
10914
  dispose: () => l.off()
10874
10915
  };
10875
10916
  }
10917
+ /** Opens the camera into a host and hands the video to `onFrame` at the set rate while it is live. */
10876
10918
  function mountCameraFeed(host, o = {}) {
10877
10919
  const video = document.createElement("video");
10878
10920
  video.autoplay = true;
@@ -10976,6 +11018,7 @@ function hosted(setupMount, deps = () => []) {
10976
11018
  });
10977
11019
  };
10978
11020
  }
11021
+ /** Vue component for a model picker of one job; emits `pick`, `choose`, `loaded` and `failed`. */
10979
11022
  const ModelSelect = /* @__PURE__ */ defineComponent({
10980
11023
  name: "ModelSelect",
10981
11024
  props: {
@@ -11037,6 +11080,7 @@ const ModelSelect = /* @__PURE__ */ defineComponent({
11037
11080
  p.go
11038
11081
  ])
11039
11082
  });
11083
+ /** Vue component for the turns of a chat thread. */
11040
11084
  const ChatPane = /* @__PURE__ */ defineComponent({
11041
11085
  name: "ChatPane",
11042
11086
  props: {
@@ -11063,6 +11107,7 @@ const ChatPane = /* @__PURE__ */ defineComponent({
11063
11107
  emptyNote: p.emptyNote
11064
11108
  }), (p) => [p.thread])
11065
11109
  });
11110
+ /** Vue component for the message box of a chat thread. */
11066
11111
  const Composer = /* @__PURE__ */ defineComponent({
11067
11112
  name: "Composer",
11068
11113
  props: {
@@ -11077,6 +11122,7 @@ const Composer = /* @__PURE__ */ defineComponent({
11077
11122
  },
11078
11123
  setup: hosted((host, p) => mountComposer(host, p.thread, { placeholder: p.placeholder }), (p) => [p.thread])
11079
11124
  });
11125
+ /** Vue component for the drop zone that becomes the transcript; emits `sample`. */
11080
11126
  const TranscribeDrop = /* @__PURE__ */ defineComponent({
11081
11127
  name: "TranscribeDrop",
11082
11128
  props: {
@@ -11102,6 +11148,7 @@ const TranscribeDrop = /* @__PURE__ */ defineComponent({
11102
11148
  } : {}
11103
11149
  }), (p) => [p.queue])
11104
11150
  });
11151
+ /** Vue component for the selected transcript, or its export buttons when `exports` is set. */
11105
11152
  const TranscriptView = /* @__PURE__ */ defineComponent({
11106
11153
  name: "TranscriptView",
11107
11154
  props: {
@@ -11116,6 +11163,10 @@ const TranscriptView = /* @__PURE__ */ defineComponent({
11116
11163
  },
11117
11164
  setup: hosted((host, p) => p.exports ? mountTranscriptExports(host, p.queue) : mountTranscriptView(host, p.queue), (p) => [p.queue, p.exports])
11118
11165
  });
11166
+ /**
11167
+ * Vue component for a mask studio; emits `studio` with the mounted studio and `sample` when the
11168
+ * sample button is pressed.
11169
+ */
11119
11170
  const MaskStudio = /* @__PURE__ */ defineComponent({
11120
11171
  name: "MaskStudio",
11121
11172
  props: {
@@ -11152,6 +11203,7 @@ const MaskStudio = /* @__PURE__ */ defineComponent({
11152
11203
  });
11153
11204
  }
11154
11205
  });
11206
+ /** Vue component for the tool rail of a mask studio. */
11155
11207
  const MaskTools = /* @__PURE__ */ defineComponent({
11156
11208
  name: "MaskTools",
11157
11209
  props: { studio: {
@@ -11160,6 +11212,7 @@ const MaskTools = /* @__PURE__ */ defineComponent({
11160
11212
  } },
11161
11213
  setup: hosted((host, p) => mountMaskTools(host, p.studio), (p) => [p.studio])
11162
11214
  });
11215
+ /** Vue component for the undo, redo and zoom row of a mask studio. */
11163
11216
  const MaskVerbs = /* @__PURE__ */ defineComponent({
11164
11217
  name: "MaskVerbs",
11165
11218
  props: { studio: {
@@ -11168,6 +11221,7 @@ const MaskVerbs = /* @__PURE__ */ defineComponent({
11168
11221
  } },
11169
11222
  setup: hosted((host, p) => mountMaskVerbs(host, p.studio), (p) => [p.studio])
11170
11223
  });
11224
+ /** Vue component for one rack part of a mask studio: found, mask, saved or export. */
11171
11225
  const MaskRack = /* @__PURE__ */ defineComponent({
11172
11226
  name: "MaskRack",
11173
11227
  props: {
@@ -11186,6 +11240,7 @@ const MaskRack = /* @__PURE__ */ defineComponent({
11186
11240
  },
11187
11241
  setup: hosted((host, p) => mountMaskRack(host, p.studio, p.part, { name: p.name }), (p) => [p.studio, p.part])
11188
11242
  });
11243
+ /** Vue component for a jobs rack: a line per job, presets and load all. */
11189
11244
  const ModelJobs = /* @__PURE__ */ defineComponent({
11190
11245
  name: "ModelJobs",
11191
11246
  props: {
@@ -11200,6 +11255,7 @@ const ModelJobs = /* @__PURE__ */ defineComponent({
11200
11255
  },
11201
11256
  setup: hosted((host, p) => mountModelJobs(host, p.jobs, { go: p.go }), (p) => [p.jobs, p.go])
11202
11257
  });
11258
+ /** Vue component for the file list of a transcribe queue. */
11203
11259
  const TranscribeQueue = /* @__PURE__ */ defineComponent({
11204
11260
  name: "TranscribeQueue",
11205
11261
  props: { queue: {
@@ -11208,6 +11264,7 @@ const TranscribeQueue = /* @__PURE__ */ defineComponent({
11208
11264
  } },
11209
11265
  setup: hosted((host, p) => mountTranscribeQueue(host, p.queue), (p) => [p.queue])
11210
11266
  });
11267
+ /** Vue component that shows a recall trace as a table. */
11211
11268
  const MemoryInspector = /* @__PURE__ */ defineComponent({
11212
11269
  name: "MemoryInspector",
11213
11270
  props: { recall: {
@@ -11226,6 +11283,7 @@ const MemoryInspector = /* @__PURE__ */ defineComponent({
11226
11283
  });
11227
11284
  }
11228
11285
  });
11286
+ /** Vue component for the chat list rail of a `chatList`. */
11229
11287
  const ChatList = /* @__PURE__ */ defineComponent({
11230
11288
  name: "ChatList",
11231
11289
  props: {
@@ -11240,6 +11298,7 @@ const ChatList = /* @__PURE__ */ defineComponent({
11240
11298
  },
11241
11299
  setup: hosted((host, p) => mountChatList(host, p.list, { label: p.label }), (p) => [p.list])
11242
11300
  });
11301
+ /** Vue component that shows what the next request carries against the context budget. */
11243
11302
  const ContextMeter = /* @__PURE__ */ defineComponent({
11244
11303
  name: "ContextMeter",
11245
11304
  props: {
@@ -11261,6 +11320,10 @@ const ContextMeter = /* @__PURE__ */ defineComponent({
11261
11320
  system: () => p.system
11262
11321
  }), (p) => [p.thread])
11263
11322
  });
11323
+ /**
11324
+ * Vue component that draws a frame with boxes, landmarks and a caption; emits `view` with the
11325
+ * mounted view.
11326
+ */
11264
11327
  const FrameView = /* @__PURE__ */ defineComponent({
11265
11328
  name: "FrameView",
11266
11329
  props: {
@@ -11297,6 +11360,7 @@ const FrameView = /* @__PURE__ */ defineComponent({
11297
11360
  });
11298
11361
  }
11299
11362
  });
11363
+ /** Vue component that opens the camera; emits `feed` with the feed and `frame` with the video at `fps`. */
11300
11364
  const CameraFeed = /* @__PURE__ */ defineComponent({
11301
11365
  name: "CameraFeed",
11302
11366
  props: { fps: {