@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.
@@ -1417,6 +1417,7 @@ var HackbuildAiViewsElements = (function(exports) {
1417
1417
  }
1418
1418
  };
1419
1419
  }
1420
+ /** Creates a chat thread that streams replies from an engine, with optional memory recall per message. */
1420
1421
  function chatThread(o = {}) {
1421
1422
  let engine = o.engine ?? null;
1422
1423
  const now = o.now ?? (() => Date.now());
@@ -1569,6 +1570,10 @@ var HackbuildAiViewsElements = (function(exports) {
1569
1570
  }
1570
1571
  };
1571
1572
  }
1573
+ /**
1574
+ * Creates a list of chat threads, newest first, with one open; its `thread` always speaks for the
1575
+ * open chat.
1576
+ */
1572
1577
  function chatList(o = {}) {
1573
1578
  const now = o.now ?? (() => Date.now());
1574
1579
  let engine = o.engine ?? null;
@@ -1728,7 +1733,7 @@ var HackbuildAiViewsElements = (function(exports) {
1728
1733
  skipped
1729
1734
  };
1730
1735
  }
1731
- /** The onnxruntime-web ladder the earlier transcription tool walks after one fetch: webgpu at basic, all, disabled, then wasm. */
1736
+ /** The onnxruntime-web ladder to walk after one fetch: webgpu at basic, all, disabled, then wasm. */
1732
1737
  function ortLadder() {
1733
1738
  return [
1734
1739
  {
@@ -1762,6 +1767,7 @@ var HackbuildAiViewsElements = (function(exports) {
1762
1767
  ];
1763
1768
  }
1764
1769
  // packages/models/src/pins.ts
1770
+ /** Pinned commits and file hashes per Hugging Face repo, written by tools/pin-weights.mjs. */
1765
1771
  const PINS = {
1766
1772
  "HuggingFaceTB/SmolLM2-135M-Instruct": {
1767
1773
  "revision": "12fd25f77366fa6b3b4b768ec3050bf629380bac",
@@ -4610,6 +4616,7 @@ var HackbuildAiViewsElements = (function(exports) {
4610
4616
  * added to a registry, so every loader resolves `resolve/<commit>/` URLs,
4611
4617
  * and pinnedSha gives the SHA-256 for such a URL.
4612
4618
  */
4619
+ /** The pin of a repo, or undefined when the repo is not pinned. */
4613
4620
  function pinOf(repo) {
4614
4621
  return repo && Object.hasOwn(PINS, repo) ? PINS[repo] : void 0;
4615
4622
  }
@@ -4619,15 +4626,15 @@ var HackbuildAiViewsElements = (function(exports) {
4619
4626
  }
4620
4627
  // packages/models/src/catalog.ts
4621
4628
  /**
4622
- * Starter records. Sizes marked "inferred" come from the builds' tables or
4629
+ * Starter records. Sizes marked "inferred" come from published tables or
4623
4630
  * from parameter count times bits and are not measured downloads. Chat rows
4624
4631
  * marked "measured" sum the Content-Length of a HEAD request on every file
4625
4632
  * the runtime loads, at the repo head of 2026-11-24, in MiB; no weight was
4626
4633
  * downloaded. WebLLM rows count the Hugging Face repo and leave out the
4627
4634
  * model library wasm, which comes from another host. Licences on the older rows are the ones on each model card as
4628
4635
  * of 2026-11-22; on the chat rows added 2026-11-24 they are the model card
4629
- * licence field the Hugging Face API returns, or the design harvest's
4630
- * string, and were not checked (owner decision). Recheck before shipping a
4636
+ * licence field the Hugging Face API returns, or a recorded string, and
4637
+ * were not checked (owner decision). Recheck before shipping a
4631
4638
  * product on them. Add your own records with registry.add().
4632
4639
  *
4633
4640
  * vramMB marked "computed" on the 14 WebLLM rows added 2026-11-25 is the
@@ -4636,13 +4643,13 @@ var HackbuildAiViewsElements = (function(exports) {
4636
4643
  * Rows with sizeSource "vendor" added 2026-11-25 sum the file sizes of the
4637
4644
  * Hugging Face listing of the repo (no download), converted to MiB.
4638
4645
  * Every row carries a speed word and a verdict of one to four words: what
4639
- * a person picks by, in the owner's voice, as the earlier tools wrote them.
4646
+ * a person picks by, in the owner's voice.
4640
4647
  *
4641
4648
  * Catalogue facts (params, quant, VRAM, censorship, tags, note) are copied
4642
- * from the owners' tool labels and the WebLLM catalogue as recorded in the
4643
- * design harvest; VRAM figures are the catalogue's own (vendor). Licence
4649
+ * from the owner's model labels and the WebLLM catalogue; VRAM figures are the catalogue's own (vendor). Licence
4644
4650
  * strings are shown as recorded and were not verified for these facts.
4645
4651
  */
4652
+ /** The starter model records, each with its size source and weight licence. */
4646
4653
  const CATALOG = [
4647
4654
  {
4648
4655
  id: "smollm2-135m-instruct",
@@ -5198,7 +5205,7 @@ var HackbuildAiViewsElements = (function(exports) {
5198
5205
  tier: "large",
5199
5206
  family: "gemma",
5200
5207
  tags: [],
5201
- note: "an uncensored gemma 4 brain. the earlier clone chat's default; it warns with no webgpu.",
5208
+ note: "an uncensored gemma 4 brain. it warns with no webgpu.",
5202
5209
  group: "uncensored",
5203
5210
  badge: "best",
5204
5211
  speed: "slow",
@@ -5232,7 +5239,7 @@ var HackbuildAiViewsElements = (function(exports) {
5232
5239
  tier: "medium",
5233
5240
  family: "gemma",
5234
5241
  tags: [],
5235
- note: "lighter gemma 4. the earlier room's default with webgpu.",
5242
+ note: "lighter gemma 4. a chat default with webgpu.",
5236
5243
  group: "uncensored",
5237
5244
  badge: "lighter",
5238
5245
  speed: "steady",
@@ -5408,7 +5415,7 @@ var HackbuildAiViewsElements = (function(exports) {
5408
5415
  tier: "small",
5409
5416
  family: "qwen3.5",
5410
5417
  tags: ["no gpu"],
5411
- note: "the earlier room's default with no webgpu. thin for long chats.",
5418
+ note: "a chat default with no webgpu. thin for long chats.",
5412
5419
  group: "uncensored",
5413
5420
  badge: "faster",
5414
5421
  speed: "fast",
@@ -5540,7 +5547,7 @@ var HackbuildAiViewsElements = (function(exports) {
5540
5547
  tier: "small",
5541
5548
  family: "qwen3",
5542
5549
  tags: ["think"],
5543
- note: "a small qwen3 with a think trace. an earlier room's deliberator.",
5550
+ note: "a small qwen3 with a think trace. fits a deliberator role.",
5544
5551
  group: "reasoning",
5545
5552
  badge: "think, easier on memory",
5546
5553
  speed: "fast",
@@ -6210,25 +6217,25 @@ var HackbuildAiViewsElements = (function(exports) {
6210
6217
  }
6211
6218
  return spec.wasmFirst ? [...cpu, ...gpu] : [...gpu, ...cpu];
6212
6219
  }
6213
- /** onnxruntime-web rungs: the earlier transcription tool walk, or wasm only when the graph is known to fail on webgpu. */
6220
+ /** onnxruntime-web rungs: webgpu then wasm, or wasm only when the graph is known to fail on webgpu. */
6214
6221
  function ortRungs(opts = {}) {
6215
6222
  const all = ortLadder();
6216
6223
  return opts.webgpu === false ? all.filter((r) => r.device === "wasm") : all;
6217
6224
  }
6218
- /** Ladders by name, from the builds. Each model record may copy one or write its own. */
6225
+ /** Ladders by name, one per model family. Each model record may copy one or write its own. */
6219
6226
  const LADDERS = {
6220
- /** an earlier relief bench runDepth. */
6227
+ /** Depth: fp16 then fp32 on webgpu, q8 then fp32 on wasm. */
6221
6228
  depth: () => tjsLadder({
6222
6229
  webgpu: ["fp16", "fp32"],
6223
6230
  wasm: ["q8", "fp32"]
6224
6231
  }),
6225
- /** earlier builds: perception models on cpu by default. */
6232
+ /** Perception models on cpu by default. */
6226
6233
  perceptionCpu: () => tjsLadder({
6227
6234
  webgpu: ["fp32"],
6228
6235
  wasm: ["q8", "fp32"],
6229
6236
  wasmFirst: true
6230
6237
  }),
6231
- /** whisper-large-v3-turbo (weights MIT), as the earlier transcription tool ran it. */
6238
+ /** whisper-large-v3-turbo (weights MIT). */
6232
6239
  whisperTurbo: () => tjsLadder({
6233
6240
  webgpu: [{
6234
6241
  encoder_model: "fp16",
@@ -6253,7 +6260,7 @@ var HackbuildAiViewsElements = (function(exports) {
6253
6260
  decoder_model_merged: "q8"
6254
6261
  }]
6255
6262
  }),
6256
- /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm, as earlier builds ran it. */
6263
+ /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm. */
6257
6264
  smolvlm: () => tjsLadder({
6258
6265
  webgpu: [{
6259
6266
  embed_tokens: "fp32",
@@ -6271,7 +6278,7 @@ var HackbuildAiViewsElements = (function(exports) {
6271
6278
  }],
6272
6279
  freshHeapRetry: true
6273
6280
  }),
6274
- /** earlier builds: q4f16 on webgpu only. */
6281
+ /** q4f16 on webgpu only. */
6275
6282
  vlmGpuOnly: () => tjsLadder({ webgpu: ["q4f16", "q4"] }),
6276
6283
  ort: ortRungs
6277
6284
  };
@@ -6280,6 +6287,7 @@ var HackbuildAiViewsElements = (function(exports) {
6280
6287
  * Embedder records for the models hub. Sizes are inferred from the model
6281
6288
  * repos' file lists; licences are the model cards' as of 2026-11-22.
6282
6289
  */
6290
+ /** Hub records for potion-base-8M, all-MiniLM-L6-v2 and bge-small-en-v1.5. */
6283
6291
  const EMBED_RECORDS = [
6284
6292
  {
6285
6293
  id: "potion-base-8m",
@@ -6299,7 +6307,7 @@ var HackbuildAiViewsElements = (function(exports) {
6299
6307
  licence: "MIT",
6300
6308
  commercial: true,
6301
6309
  place: "main",
6302
- notes: ["256 dims, no runtime, about 0.08 ms per sentence in an earlier build (measured there, not here)", "misses paraphrase"]
6310
+ notes: ["256 dims, no runtime, about 0.08 ms per sentence (measured outside this repository)", "misses paraphrase"]
6303
6311
  },
6304
6312
  {
6305
6313
  id: "minilm-l6",
@@ -6321,7 +6329,7 @@ var HackbuildAiViewsElements = (function(exports) {
6321
6329
  commercial: true,
6322
6330
  place: "cpu-worker",
6323
6331
  runtime: "@huggingface/transformers@4.3.2",
6324
- notes: ["384 dims; webgpu with q8 garbled other models in earlier builds, so q8 stays on wasm"]
6332
+ notes: ["384 dims; webgpu with q8 garbled other models, so q8 stays on wasm"]
6325
6333
  },
6326
6334
  {
6327
6335
  id: "bge-small-en",
@@ -6367,6 +6375,7 @@ var HackbuildAiViewsElements = (function(exports) {
6367
6375
  height_latent: 64,
6368
6376
  width_latent: 64
6369
6377
  } };
6378
+ /** The image models {@link attachImagegen} registers: SD-Turbo and SD 1.5, each with its licence, size and form. */
6370
6379
  const IMAGEGEN_RECORDS = [{
6371
6380
  id: "sd-turbo",
6372
6381
  label: "sd-turbo 512",
@@ -6391,9 +6400,9 @@ var HackbuildAiViewsElements = (function(exports) {
6391
6400
  place: "gpu",
6392
6401
  runtime: "onnxruntime-web@1.27.0",
6393
6402
  notes: [
6394
- "webgpu only in an earlier build, no wasm floor",
6403
+ "webgpu only, no wasm floor",
6395
6404
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)",
6396
- "graph file paths inferred from an earlier build, not checked against the repo"
6405
+ "graph file paths inferred, not checked against the repo"
6397
6406
  ],
6398
6407
  form: {
6399
6408
  steps: {
@@ -6433,7 +6442,7 @@ var HackbuildAiViewsElements = (function(exports) {
6433
6442
  place: "gpu",
6434
6443
  runtime: "onnxruntime-web@1.27.0",
6435
6444
  notes: [
6436
- "about 2 GB by an earlier bench's label (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
6445
+ "about 2 GB (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
6437
6446
  "runs the unet twice a step for guidance, so a step costs about twice an sd-turbo step (inferred)",
6438
6447
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)"
6439
6448
  ],
@@ -6490,7 +6499,7 @@ var HackbuildAiViewsElements = (function(exports) {
6490
6499
  commercial: "unknown",
6491
6500
  place: "gpu",
6492
6501
  runtime: "onnxruntime-web@1.27.0",
6493
- 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"],
6502
+ 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"],
6494
6503
  form: {
6495
6504
  steps: {
6496
6505
  min: 1,
@@ -6534,6 +6543,7 @@ var HackbuildAiViewsElements = (function(exports) {
6534
6543
  function cueText(t) {
6535
6544
  return t.replace(/-->/g, "->").replace(/\n\s*\n/g, "\n");
6536
6545
  }
6546
+ /** SubRip text: numbered cues with comma millisecond stamps. */
6537
6547
  function toSrt(segs) {
6538
6548
  return segs.map((s, i) => `${i + 1}\n${timestamp(s.start, true)} --> ${timestamp(s.end, true)}\n${cueText(s.text)}\n`).join("\n");
6539
6549
  }
@@ -6547,6 +6557,7 @@ var HackbuildAiViewsElements = (function(exports) {
6547
6557
  return t;
6548
6558
  })();
6549
6559
  // packages/speak/src/records.ts
6560
+ /** Model records for the voices this package drives, for pickers and the models registry. */
6550
6561
  const SPEAK_RECORDS = [
6551
6562
  {
6552
6563
  id: "kokoro-82m",
@@ -6571,7 +6582,7 @@ var HackbuildAiViewsElements = (function(exports) {
6571
6582
  commercial: true,
6572
6583
  place: "cpu-worker",
6573
6584
  runtime: "kokoro-js@1.2.1",
6574
- 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"]
6585
+ notes: ["webgpu with q8 has given garbled audio", "fp32 weights (about 330 MB, inferred) do not cache on file://, so webgpu needs http"]
6575
6586
  },
6576
6587
  {
6577
6588
  id: "pocket-tts",
@@ -6639,8 +6650,7 @@ var HackbuildAiViewsElements = (function(exports) {
6639
6650
  // packages/transcribe/src/records.ts
6640
6651
  /**
6641
6652
  * Speech to text records for the models hub. Ladders and dtypes are
6642
- * the earlier transcription tool's per model table; sizes are inferred from the builds'
6643
- * notes, except rows marked vendor: those sum the quantized encoder and
6653
+ * one per model table; sizes are inferred from the model notes, except rows marked vendor: those sum the quantized encoder and
6644
6654
  * decoder in the hub listing (no download, 2026-11-25), in MiB. Licences are the model cards' as of 2026-11-22.
6645
6655
  */
6646
6656
  const asr = (r) => ({
@@ -6652,6 +6662,7 @@ var HackbuildAiViewsElements = (function(exports) {
6652
6662
  runtime: "@huggingface/transformers@4.3.2",
6653
6663
  ...r
6654
6664
  });
6665
+ /** The Whisper and Moonshine model records for the models hub. */
6655
6666
  const TRANSCRIBE_RECORDS = [
6656
6667
  asr({
6657
6668
  id: "whisper-large-v3-turbo",
@@ -6665,7 +6676,7 @@ var HackbuildAiViewsElements = (function(exports) {
6665
6676
  ladder: LADDERS.whisperTurbo(),
6666
6677
  licence: "MIT",
6667
6678
  place: "gpu",
6668
- 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)"]
6679
+ 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)"]
6669
6680
  }),
6670
6681
  asr({
6671
6682
  id: "whisper-base",
@@ -6702,7 +6713,7 @@ var HackbuildAiViewsElements = (function(exports) {
6702
6713
  sizeMB: 90,
6703
6714
  ladder: LADDERS.whisperSmall(false),
6704
6715
  licence: "MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0)",
6705
- notes: ["english only; the earlier transcription tool's no gpu default"]
6716
+ notes: ["english only; the default with no gpu"]
6706
6717
  }),
6707
6718
  asr({
6708
6719
  id: "whisper-tiny.en",
@@ -6743,15 +6754,15 @@ var HackbuildAiViewsElements = (function(exports) {
6743
6754
  ];
6744
6755
  // packages/transcribe/src/export.ts
6745
6756
  /**
6746
- * Transcript exports in the earlier transcription tool's layouts: txt, srt,
6757
+ * Transcript exports as txt, srt,
6747
6758
  * vtt and json per file, and one store only zip with four files per
6748
6759
  * source plus `manifest.json`. The manifest records the model and language
6749
- * of each file's own run (the earlier tool wrote the select values at
6750
- * export time, which could differ from the run). A speaker label, when a
6760
+ * of each file's own run. A speaker label, when a
6751
6761
  * person set one, leads the line in txt and srt and is a voice tag in vtt.
6752
6762
  */
6753
6763
  const said = (s) => s.speaker ? `${s.speaker}: ${s.text}` : s.text;
6754
6764
  const r3 = (x) => +x.toFixed(3);
6765
+ /** Plain text with speaker labels leading their lines; a gap over 2 s starts a paragraph. */
6755
6766
  function asTxt(segs) {
6756
6767
  return toTxt(segs.map((s) => ({
6757
6768
  start: s.start,
@@ -6759,6 +6770,7 @@ var HackbuildAiViewsElements = (function(exports) {
6759
6770
  text: said(s)
6760
6771
  })));
6761
6772
  }
6773
+ /** SubRip text with speaker labels leading their lines. */
6762
6774
  function asSrt(segs) {
6763
6775
  return toSrt(segs.map((s) => ({
6764
6776
  start: s.start,
@@ -6767,6 +6779,7 @@ var HackbuildAiViewsElements = (function(exports) {
6767
6779
  })));
6768
6780
  }
6769
6781
  const esc$1 = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
6782
+ /** WebVTT text with speakers as voice tags and cue text escaped. */
6770
6783
  function asVtt(segs) {
6771
6784
  const cue = (s) => {
6772
6785
  const body = esc$1(s.text.replace(/-->/g, "->").replace(/\n\s*\n/g, "\n"));
@@ -6822,6 +6835,7 @@ var HackbuildAiViewsElements = (function(exports) {
6822
6835
  * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
6823
6836
  * swap set sit in PICKER_RECORDS.
6824
6837
  */
6838
+ /** The MediaPipe model storage base URL the MediaPipe records load from. */
6825
6839
  const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
6826
6840
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
6827
6841
  const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
@@ -6842,6 +6856,7 @@ var HackbuildAiViewsElements = (function(exports) {
6842
6856
  place: "main",
6843
6857
  runtime: "@mediapipe/tasks-vision@1.2.3"
6844
6858
  });
6859
+ /** The vision records registered by `attachVision`: Depth Anything V2 small, MediaPipe detection, segmentation and landmarks, SlimSAM, SmolVLM 256M and LFM2-VL 450M. */
6845
6860
  const VISION_RECORDS = [
6846
6861
  {
6847
6862
  id: "depth-anything-v2-small",
@@ -6859,7 +6874,7 @@ var HackbuildAiViewsElements = (function(exports) {
6859
6874
  commercial: true,
6860
6875
  place: "cpu-worker",
6861
6876
  runtime: "@huggingface/transformers@4.3.2",
6862
- notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"]
6877
+ notes: ["fp16 on webgpu, fp32 on the same device after a failure"]
6863
6878
  },
6864
6879
  mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
6865
6880
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
@@ -6891,7 +6906,7 @@ var HackbuildAiViewsElements = (function(exports) {
6891
6906
  commercial: true,
6892
6907
  place: "cpu-worker",
6893
6908
  runtime: "@huggingface/transformers@4.3.2",
6894
- notes: ["earlier builds: one image embedding, then any number of point prompts"]
6909
+ notes: ["one image embedding, then any number of point prompts"]
6895
6910
  },
6896
6911
  {
6897
6912
  id: "smolvlm-256m-instruct",
@@ -6934,13 +6949,12 @@ var HackbuildAiViewsElements = (function(exports) {
6934
6949
  commercial: "unknown",
6935
6950
  place: "gpu",
6936
6951
  runtime: "@huggingface/transformers@4.3.2",
6937
- notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
6952
+ notes: ["q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
6938
6953
  }
6939
6954
  ];
6940
6955
  /**
6941
6956
  * Records listed for pickers and never registered by default, so a hub's
6942
- * routing by capability keeps its small defaults: larger alternates the
6943
- * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
6957
+ * routing by capability keeps its small defaults: larger alternates (smolvlm 500m and 2 video, gemma 4 e2b, two more
6944
6958
  * depth models), and records under licences that limit use (YOLOv10 and
6945
6959
  * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
6946
6960
  * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
@@ -6974,8 +6988,9 @@ var HackbuildAiViewsElements = (function(exports) {
6974
6988
  licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
6975
6989
  commercial: false,
6976
6990
  place: "gpu",
6977
- 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"]
6991
+ 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"]
6978
6992
  });
6993
+ /** Records listed for pickers and never registered by default: larger alternates, and records under licences that limit use (YOLOv10, FastSAM, the face swap set). */
6979
6994
  const PICKER_RECORDS = [
6980
6995
  {
6981
6996
  id: "smolvlm-500m-instruct",
@@ -7018,7 +7033,7 @@ var HackbuildAiViewsElements = (function(exports) {
7018
7033
  commercial: true,
7019
7034
  place: "cpu-worker",
7020
7035
  runtime: "@huggingface/transformers@4.3.2",
7021
- notes: ["an earlier room offered it beside smolvlm 256m and 500m"]
7036
+ notes: ["an option beside smolvlm 256m and 500m"]
7022
7037
  },
7023
7038
  {
7024
7039
  id: "depth-anything-v2-base",
@@ -7075,7 +7090,7 @@ var HackbuildAiViewsElements = (function(exports) {
7075
7090
  commercial: true,
7076
7091
  place: "gpu",
7077
7092
  runtime: "@huggingface/transformers@4.3.2",
7078
- notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"]
7093
+ notes: ["about 3.3 GB (vendor)"]
7079
7094
  },
7080
7095
  yolo10("n", 9, "instant", "nano, quick"),
7081
7096
  yolo10("s", 28, "fast", "small, sharper"),
@@ -7104,7 +7119,7 @@ var HackbuildAiViewsElements = (function(exports) {
7104
7119
  licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
7105
7120
  commercial: false,
7106
7121
  place: "cpu-worker",
7107
- 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"]
7122
+ notes: ["finds every mask in one pass on onnxruntime-web (93 MB, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
7108
7123
  },
7109
7124
  {
7110
7125
  id: "scrfd-10g",
@@ -7177,7 +7192,7 @@ var HackbuildAiViewsElements = (function(exports) {
7177
7192
  licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
7178
7193
  commercial: false,
7179
7194
  place: "gpu",
7180
- notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"]
7195
+ notes: ["128 px faces; paste the result back with a feathered mask"]
7181
7196
  }
7182
7197
  ];
7183
7198
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
@@ -7206,9 +7221,10 @@ var HackbuildAiViewsElements = (function(exports) {
7206
7221
  * records come from the packages that run them; a record listed in more
7207
7222
  * than one place counts once, the running package's copy first.
7208
7223
  */
7209
- /** face-api weights (MIT) as an earlier face swap tool loaded them, from the package CDN. */
7224
+ /** Base URL of the face-api weights (MIT) on the package CDN. */
7210
7225
  const FACE_API_BASE = "https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.12/model/";
7211
7226
  const has = (...want) => (caps) => caps.some((c) => want.includes(c));
7227
+ /** The words and capability test of every job. */
7212
7228
  const JOBS = {
7213
7229
  chat: {
7214
7230
  label: "brain",
@@ -7304,6 +7320,7 @@ var HackbuildAiViewsElements = (function(exports) {
7304
7320
  const def = JOBS[job];
7305
7321
  return records.filter((r) => def.provides(r.provides));
7306
7322
  }
7323
+ /** Whether a string is a job name. */
7307
7324
  function isJob(s) {
7308
7325
  return !!s && s in JOBS;
7309
7326
  }
@@ -7320,9 +7337,11 @@ var HackbuildAiViewsElements = (function(exports) {
7320
7337
  "no download": "none",
7321
7338
  own: "own"
7322
7339
  };
7340
+ /** Whether a record has nothing to download: a built in, system or zero size model. */
7323
7341
  function isNoDownload(r) {
7324
7342
  return !!r.noDownload || r.sizeMB === 0 || r.provider === "prompt-api" || r.provider === "system";
7325
7343
  }
7344
+ /** Whether a record's censorship is "uncensored" or "abliterated". */
7326
7345
  function isUncensored(r) {
7327
7346
  return r.censorship === "uncensored" || r.censorship === "abliterated";
7328
7347
  }
@@ -7555,6 +7574,7 @@ var HackbuildAiViewsElements = (function(exports) {
7555
7574
  }).unfit === void 0);
7556
7575
  return (fits.find((r) => r.group === "start here") ?? fits.find((r) => r.speed === "fast" || r.speed === "steady") ?? fits[0] ?? records[0])?.id ?? "";
7557
7576
  }
7577
+ /** Creates a model picker for a job, with rows that say whether each model fits this machine. */
7558
7578
  function useModelPick(job, o = {}) {
7559
7579
  const def = JOBS[job];
7560
7580
  let records = jobRecords(job, o.records ?? ALL_RECORDS);
@@ -7694,6 +7714,7 @@ var HackbuildAiViewsElements = (function(exports) {
7694
7714
  error: (id) => errors.get(id)
7695
7715
  };
7696
7716
  }
7717
+ /** Creates one picker per job and joins them as a rack with presets and load all. */
7697
7718
  function useJobsPick(jobs, initialPresets = [], shared = {}) {
7698
7719
  let presets = initialPresets;
7699
7720
  const extra = /* @__PURE__ */ new Set();
@@ -7820,13 +7841,14 @@ var HackbuildAiViewsElements = (function(exports) {
7820
7841
  };
7821
7842
  // packages/ai-views/src/mount-chat.ts
7822
7843
  /**
7823
- * ChatPane and Composer in the DOM, after the earlier chat tools: the
7844
+ * ChatPane and Composer in the DOM: the
7824
7845
  * thread as hackbuild-ui messages, the reasoning in a fold that is open
7825
7846
  * while it streams, the memory a reply used in a fold under it, copy and
7826
7847
  * redo on the last reply only, and a composer whose send is the one pink
7827
7848
  * action and turns into stop while a reply streams.
7828
7849
  */
7829
7850
  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("");
7851
+ /** The HTML of one chat turn, with its reasoning fold, memory used and stats. */
7830
7852
  function turnHtml(t, o) {
7831
7853
  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>`;
7832
7854
  const live = !t.done;
@@ -8011,7 +8033,7 @@ var HackbuildAiViewsElements = (function(exports) {
8011
8033
  }
8012
8034
  // packages/ai-views/src/mount-frame.ts
8013
8035
  /**
8014
- * FrameView and CameraFeed, after the eyes view of an earlier room: a
8036
+ * FrameView and CameraFeed: a
8015
8037
  * frame in a hackbuild-ui camera tile with what the models found drawn
8016
8038
  * over it (boxes with their word and score, landmark points and lines),
8017
8039
  * a count in the corner and the caption under it. CameraFeed opens the
@@ -8024,6 +8046,7 @@ var HackbuildAiViewsElements = (function(exports) {
8024
8046
  return fb;
8025
8047
  }
8026
8048
  };
8049
+ /** Draws a frame in a camera tile on a host, with boxes, landmarks, a corner tag and a caption over it. */
8027
8050
  function mountFrameView(host, o = {}) {
8028
8051
  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>`;
8029
8052
  const fig = host.querySelector("figure");
@@ -8179,6 +8202,7 @@ var HackbuildAiViewsElements = (function(exports) {
8179
8202
  dispose: () => l.off()
8180
8203
  };
8181
8204
  }
8205
+ /** Opens the camera into a host and hands the video to `onFrame` at the set rate while it is live. */
8182
8206
  function mountCameraFeed(host, o = {}) {
8183
8207
  const video = document.createElement("video");
8184
8208
  video.autoplay = true;
@@ -8259,7 +8283,7 @@ var HackbuildAiViewsElements = (function(exports) {
8259
8283
  }
8260
8284
  // packages/ai-views/src/mount-mask.ts
8261
8285
  /**
8262
- * MaskStudio, after the earlier mask studio: drop an image, press a thing
8286
+ * MaskStudio: drop an image, press a thing
8263
8287
  * to cut it out (a click segment model such as SlimSAM), fix the mask by
8264
8288
  * hand with the wand, brush and lasso of hackbuild-ui maskEditor (x swaps
8265
8289
  * add and erase, [ and ] size the brush, ctrl z undoes), zoom and fit, and
@@ -8303,6 +8327,10 @@ var HackbuildAiViewsElements = (function(exports) {
8303
8327
  t.getContext("2d")?.drawImage(c, 0, 0, t.width, t.height);
8304
8328
  return t.toDataURL("image/png");
8305
8329
  }
8330
+ /**
8331
+ * Mounts a mask studio on a host: drop or open an image, then cut masks with the point, wand, brush
8332
+ * and lasso tools or a segment model.
8333
+ */
8306
8334
  function mountMaskStudio(host, o = {}) {
8307
8335
  let models = o.models ?? {};
8308
8336
  const l = listeners();
@@ -8694,9 +8722,29 @@ var HackbuildAiViewsElements = (function(exports) {
8694
8722
  }
8695
8723
  };
8696
8724
  }
8725
+ const FILLER = /^(instruct|chat|it|mlc|onnx|gguf|hf|q\d\w*|f16|f32|fp16|int8|bf16|uniform)$/i;
8726
+ /**
8727
+ * A model name cut for the bar chip: filler words (instruct, chat, quant tags)
8728
+ * go, and a name of more than three words keeps its first two and its last,
8729
+ * which is usually the size: "hermes 3 llama 3.2 3b" reads "hermes 3 3b".
8730
+ * A note in brackets goes first: "slimsam 77 uniform (point prompts)" reads "slimsam 77".
8731
+ */
8732
+ function shortName(name) {
8733
+ const w = name.replace(/\s*\([^)]*\)/g, "").split(/\s+/).filter((x) => x && !FILLER.test(x));
8734
+ return (w.length > 3 ? [
8735
+ w[0],
8736
+ w[1],
8737
+ w[w.length - 1]
8738
+ ] : w).join(" ") || name;
8739
+ }
8740
+ /** The chip's words: the short name, then the download size, or the state once it moves. */
8697
8741
  function chipWords(s) {
8698
- const w = $r(s.row, s.empty);
8699
- return w.state ? `${w.name}, ${w.state}` : w.name;
8742
+ const r = s.row;
8743
+ if (!r) return s.empty;
8744
+ const w = $r(r, s.empty);
8745
+ const name = shortName(r.name);
8746
+ if ((r.state === "loading" || r.state === "loaded" || r.state === "error") && w.state) return `${name}, ${w.state}`;
8747
+ return `${name}, ${r.noDownload ? "no download" : r.size ?? "size unknown"}`;
8700
8748
  }
8701
8749
  /** The closed picker over a host; pressing it opens the sheet. */
8702
8750
  function mountModelSelect(host, pick, o = {}) {
@@ -8706,7 +8754,8 @@ var HackbuildAiViewsElements = (function(exports) {
8706
8754
  if (o.variant === "chip") {
8707
8755
  const draw = (s) => {
8708
8756
  const words = chipWords(s);
8709
- 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>`;
8757
+ 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}`;
8758
+ 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>`;
8710
8759
  };
8711
8760
  l.on(host, "click", (e) => {
8712
8761
  if (e.target.closest(".hb-msel-chip")) sheet.open();
@@ -8766,11 +8815,11 @@ var HackbuildAiViewsElements = (function(exports) {
8766
8815
  }
8767
8816
  // packages/ai-views/src/mount-transcribe.ts
8768
8817
  /**
8769
- * TranscribeDrop, TranscriptView and their rack parts in the DOM, after the
8770
- * earlier transcription tool: the drop zone is the page until a file is in
8818
+ * TranscribeDrop, TranscriptView and their rack parts in the DOM: the drop zone is the page until a file is in
8771
8819
  * it, then the transcript is. Lines carry their time, edit in place (one
8772
8820
  * undo step each), and export as txt, srt, vtt and json once there is text.
8773
8821
  */
8822
+ /** The HTML of one channel's transcript, or an empty note when there is none. */
8774
8823
  function transcriptHtml(c, o = {}) {
8775
8824
  if (!c) return `<p class="hb-lay-empty-note">nothing yet. drop a file.</p>`;
8776
8825
  const st = di(c.status);
@@ -8927,8 +8976,7 @@ var HackbuildAiViewsElements = (function(exports) {
8927
8976
  }
8928
8977
  // packages/ai-views/src/transcribe.ts
8929
8978
  /**
8930
- * The state behind TranscribeDrop and TranscriptView, after the earlier
8931
- * transcription tool: drop files, they queue as channels, run one at a
8979
+ * The state behind TranscribeDrop and TranscriptView: drop files, they queue as channels, run one at a
8932
8980
  * time, and each becomes a transcript with timestamps that a person can
8933
8981
  * edit (with undo) and export as txt, srt, vtt or json. The engine is a
8934
8982
  * function the page passes, so a stub runs the view with no weights.
@@ -8939,6 +8987,7 @@ var HackbuildAiViewsElements = (function(exports) {
8939
8987
  vtt: "text/vtt",
8940
8988
  json: "application/json"
8941
8989
  };
8990
+ /** Creates a transcribe queue that runs each file through `run`, one at a time. */
8942
8991
  function transcribeQueue(o) {
8943
8992
  let run = o.run;
8944
8993
  let channels = [];
@@ -9142,6 +9191,7 @@ var HackbuildAiViewsElements = (function(exports) {
9142
9191
  // packages/ai-views/src/memory.ts
9143
9192
  const n3 = (x) => Number.isFinite(x) ? x.toFixed(3) : "none";
9144
9193
  const rank = (r) => r >= 0 ? `#${r + 1}` : "none";
9194
+ /** The rows of a recall trace as text, marking the hits handed to the model. */
9145
9195
  function traceRows(r, maxText = 80) {
9146
9196
  const used = new Set(r.hits.map((h) => h.item.id));
9147
9197
  return r.trace.map((t, i) => ({
@@ -9156,11 +9206,13 @@ var HackbuildAiViewsElements = (function(exports) {
9156
9206
  used: used.has(t.id)
9157
9207
  }));
9158
9208
  }
9209
+ /** The HTML of a recall trace table, or an empty note before any recall. */
9159
9210
  function inspectorHtml(rec) {
9160
9211
  if (!rec) return `<p class="hb-lay-empty-note">no recall yet. ask something to see what memory finds.</p>`;
9161
9212
  const rows = traceRows(rec);
9162
9213
  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>`;
9163
9214
  }
9215
+ /** Shows a recall trace as a table on a host. */
9164
9216
  function mountMemoryInspector(host, rec = null) {
9165
9217
  host.innerHTML = inspectorHtml(rec);
9166
9218
  return {
@@ -9542,6 +9594,7 @@ var HackbuildAiViewsElements = (function(exports) {
9542
9594
  });
9543
9595
  }
9544
9596
  exports.ELEMENT_NAMES = ELEMENT_NAMES;
9597
+ exports.chipWords = chipWords;
9545
9598
  exports.define = define;
9546
9599
  exports.gateWords = gateWords;
9547
9600
  exports.mountCameraFeed = mountCameraFeed;
@@ -9562,6 +9615,7 @@ var HackbuildAiViewsElements = (function(exports) {
9562
9615
  exports.mountTranscriptExports = mountTranscriptExports;
9563
9616
  exports.mountTranscriptView = mountTranscriptView;
9564
9617
  exports.pickSheet = pickSheet;
9618
+ exports.shortName = shortName;
9565
9619
  exports.transcriptHtml = transcriptHtml;
9566
9620
  exports.turnHtml = turnHtml;
9567
9621
  return exports;