@hackbuild/ai-views 0.1.0 → 0.1.1

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.
@@ -35,7 +35,7 @@ function ladderFor(rec, env) {
35
35
  skipped
36
36
  };
37
37
  }
38
- /** The onnxruntime-web ladder the earlier transcription tool walks after one fetch: webgpu at basic, all, disabled, then wasm. */
38
+ /** The onnxruntime-web ladder to walk after one fetch: webgpu at basic, all, disabled, then wasm. */
39
39
  function ortLadder() {
40
40
  return [
41
41
  {
@@ -69,6 +69,7 @@ function ortLadder() {
69
69
  ];
70
70
  }
71
71
  // packages/models/src/pins.ts
72
+ /** Pinned commits and file hashes per Hugging Face repo, written by tools/pin-weights.mjs. */
72
73
  const PINS = {
73
74
  "HuggingFaceTB/SmolLM2-135M-Instruct": {
74
75
  "revision": "12fd25f77366fa6b3b4b768ec3050bf629380bac",
@@ -2917,6 +2918,7 @@ const PINS = {
2917
2918
  * added to a registry, so every loader resolves `resolve/<commit>/` URLs,
2918
2919
  * and pinnedSha gives the SHA-256 for such a URL.
2919
2920
  */
2921
+ /** The pin of a repo, or undefined when the repo is not pinned. */
2920
2922
  function pinOf(repo) {
2921
2923
  return repo && Object.hasOwn(PINS, repo) ? PINS[repo] : void 0;
2922
2924
  }
@@ -2926,15 +2928,15 @@ function pinnedBase(repo, fallback = "main") {
2926
2928
  }
2927
2929
  // packages/models/src/catalog.ts
2928
2930
  /**
2929
- * Starter records. Sizes marked "inferred" come from the builds' tables or
2931
+ * Starter records. Sizes marked "inferred" come from published tables or
2930
2932
  * from parameter count times bits and are not measured downloads. Chat rows
2931
2933
  * marked "measured" sum the Content-Length of a HEAD request on every file
2932
2934
  * the runtime loads, at the repo head of 2026-11-24, in MiB; no weight was
2933
2935
  * downloaded. WebLLM rows count the Hugging Face repo and leave out the
2934
2936
  * model library wasm, which comes from another host. Licences on the older rows are the ones on each model card as
2935
2937
  * of 2026-11-22; on the chat rows added 2026-11-24 they are the model card
2936
- * licence field the Hugging Face API returns, or the design harvest's
2937
- * string, and were not checked (owner decision). Recheck before shipping a
2938
+ * licence field the Hugging Face API returns, or a recorded string, and
2939
+ * were not checked (owner decision). Recheck before shipping a
2938
2940
  * product on them. Add your own records with registry.add().
2939
2941
  *
2940
2942
  * vramMB marked "computed" on the 14 WebLLM rows added 2026-11-25 is the
@@ -2943,13 +2945,13 @@ function pinnedBase(repo, fallback = "main") {
2943
2945
  * Rows with sizeSource "vendor" added 2026-11-25 sum the file sizes of the
2944
2946
  * Hugging Face listing of the repo (no download), converted to MiB.
2945
2947
  * Every row carries a speed word and a verdict of one to four words: what
2946
- * a person picks by, in the owner's voice, as the earlier tools wrote them.
2948
+ * a person picks by, in the owner's voice.
2947
2949
  *
2948
2950
  * Catalogue facts (params, quant, VRAM, censorship, tags, note) are copied
2949
- * from the owners' tool labels and the WebLLM catalogue as recorded in the
2950
- * design harvest; VRAM figures are the catalogue's own (vendor). Licence
2951
+ * from the owner's model labels and the WebLLM catalogue; VRAM figures are the catalogue's own (vendor). Licence
2951
2952
  * strings are shown as recorded and were not verified for these facts.
2952
2953
  */
2954
+ /** The starter model records, each with its size source and weight licence. */
2953
2955
  const CATALOG = [
2954
2956
  {
2955
2957
  id: "smollm2-135m-instruct",
@@ -3505,7 +3507,7 @@ const CATALOG = [
3505
3507
  tier: "large",
3506
3508
  family: "gemma",
3507
3509
  tags: [],
3508
- note: "an uncensored gemma 4 brain. the earlier clone chat's default; it warns with no webgpu.",
3510
+ note: "an uncensored gemma 4 brain. it warns with no webgpu.",
3509
3511
  group: "uncensored",
3510
3512
  badge: "best",
3511
3513
  speed: "slow",
@@ -3539,7 +3541,7 @@ const CATALOG = [
3539
3541
  tier: "medium",
3540
3542
  family: "gemma",
3541
3543
  tags: [],
3542
- note: "lighter gemma 4. the earlier room's default with webgpu.",
3544
+ note: "lighter gemma 4. a chat default with webgpu.",
3543
3545
  group: "uncensored",
3544
3546
  badge: "lighter",
3545
3547
  speed: "steady",
@@ -3715,7 +3717,7 @@ const CATALOG = [
3715
3717
  tier: "small",
3716
3718
  family: "qwen3.5",
3717
3719
  tags: ["no gpu"],
3718
- note: "the earlier room's default with no webgpu. thin for long chats.",
3720
+ note: "a chat default with no webgpu. thin for long chats.",
3719
3721
  group: "uncensored",
3720
3722
  badge: "faster",
3721
3723
  speed: "fast",
@@ -3847,7 +3849,7 @@ const CATALOG = [
3847
3849
  tier: "small",
3848
3850
  family: "qwen3",
3849
3851
  tags: ["think"],
3850
- note: "a small qwen3 with a think trace. an earlier room's deliberator.",
3852
+ note: "a small qwen3 with a think trace. fits a deliberator role.",
3851
3853
  group: "reasoning",
3852
3854
  badge: "think, easier on memory",
3853
3855
  speed: "fast",
@@ -4517,25 +4519,25 @@ function tjsLadder(spec) {
4517
4519
  }
4518
4520
  return spec.wasmFirst ? [...cpu, ...gpu] : [...gpu, ...cpu];
4519
4521
  }
4520
- /** onnxruntime-web rungs: the earlier transcription tool walk, or wasm only when the graph is known to fail on webgpu. */
4522
+ /** onnxruntime-web rungs: webgpu then wasm, or wasm only when the graph is known to fail on webgpu. */
4521
4523
  function ortRungs(opts = {}) {
4522
4524
  const all = ortLadder();
4523
4525
  return opts.webgpu === false ? all.filter((r) => r.device === "wasm") : all;
4524
4526
  }
4525
- /** Ladders by name, from the builds. Each model record may copy one or write its own. */
4527
+ /** Ladders by name, one per model family. Each model record may copy one or write its own. */
4526
4528
  const LADDERS = {
4527
- /** an earlier relief bench runDepth. */
4529
+ /** Depth: fp16 then fp32 on webgpu, q8 then fp32 on wasm. */
4528
4530
  depth: () => tjsLadder({
4529
4531
  webgpu: ["fp16", "fp32"],
4530
4532
  wasm: ["q8", "fp32"]
4531
4533
  }),
4532
- /** earlier builds: perception models on cpu by default. */
4534
+ /** Perception models on cpu by default. */
4533
4535
  perceptionCpu: () => tjsLadder({
4534
4536
  webgpu: ["fp32"],
4535
4537
  wasm: ["q8", "fp32"],
4536
4538
  wasmFirst: true
4537
4539
  }),
4538
- /** whisper-large-v3-turbo (weights MIT), as the earlier transcription tool ran it. */
4540
+ /** whisper-large-v3-turbo (weights MIT). */
4539
4541
  whisperTurbo: () => tjsLadder({
4540
4542
  webgpu: [{
4541
4543
  encoder_model: "fp16",
@@ -4560,7 +4562,7 @@ const LADDERS = {
4560
4562
  decoder_model_merged: "q8"
4561
4563
  }]
4562
4564
  }),
4563
- /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm, as earlier builds ran it. */
4565
+ /** SmolVLM (weights Apache-2.0): fp16 embed and vision, q4 decoder on webgpu; q8 vision on wasm. */
4564
4566
  smolvlm: () => tjsLadder({
4565
4567
  webgpu: [{
4566
4568
  embed_tokens: "fp32",
@@ -4578,7 +4580,7 @@ const LADDERS = {
4578
4580
  }],
4579
4581
  freshHeapRetry: true
4580
4582
  }),
4581
- /** earlier builds: q4f16 on webgpu only. */
4583
+ /** q4f16 on webgpu only. */
4582
4584
  vlmGpuOnly: () => tjsLadder({ webgpu: ["q4f16", "q4"] }),
4583
4585
  ort: ortRungs
4584
4586
  };
@@ -4633,6 +4635,7 @@ async function getRepo(store, repo, opts = {}) {
4633
4635
  * Embedder records for the models hub. Sizes are inferred from the model
4634
4636
  * repos' file lists; licences are the model cards' as of 2026-11-22.
4635
4637
  */
4638
+ /** Hub records for potion-base-8M, all-MiniLM-L6-v2 and bge-small-en-v1.5. */
4636
4639
  const EMBED_RECORDS = [
4637
4640
  {
4638
4641
  id: "potion-base-8m",
@@ -4652,7 +4655,7 @@ const EMBED_RECORDS = [
4652
4655
  licence: "MIT",
4653
4656
  commercial: true,
4654
4657
  place: "main",
4655
- notes: ["256 dims, no runtime, about 0.08 ms per sentence in an earlier build (measured there, not here)", "misses paraphrase"]
4658
+ notes: ["256 dims, no runtime, about 0.08 ms per sentence (measured outside this repository)", "misses paraphrase"]
4656
4659
  },
4657
4660
  {
4658
4661
  id: "minilm-l6",
@@ -4674,7 +4677,7 @@ const EMBED_RECORDS = [
4674
4677
  commercial: true,
4675
4678
  place: "cpu-worker",
4676
4679
  runtime: "@huggingface/transformers@4.3.2",
4677
- notes: ["384 dims; webgpu with q8 garbled other models in earlier builds, so q8 stays on wasm"]
4680
+ notes: ["384 dims; webgpu with q8 garbled other models, so q8 stays on wasm"]
4678
4681
  },
4679
4682
  {
4680
4683
  id: "bge-small-en",
@@ -4720,6 +4723,7 @@ const free512 = { freeDimensionOverrides: {
4720
4723
  height_latent: 64,
4721
4724
  width_latent: 64
4722
4725
  } };
4726
+ /** The image models {@link attachImagegen} registers: SD-Turbo and SD 1.5, each with its licence, size and form. */
4723
4727
  const IMAGEGEN_RECORDS = [{
4724
4728
  id: "sd-turbo",
4725
4729
  label: "sd-turbo 512",
@@ -4744,9 +4748,9 @@ const IMAGEGEN_RECORDS = [{
4744
4748
  place: "gpu",
4745
4749
  runtime: "onnxruntime-web@1.27.0",
4746
4750
  notes: [
4747
- "webgpu only in an earlier build, no wasm floor",
4751
+ "webgpu only, no wasm floor",
4748
4752
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)",
4749
- "graph file paths inferred from an earlier build, not checked against the repo"
4753
+ "graph file paths inferred, not checked against the repo"
4750
4754
  ],
4751
4755
  form: {
4752
4756
  steps: {
@@ -4786,7 +4790,7 @@ const IMAGEGEN_RECORDS = [{
4786
4790
  place: "gpu",
4787
4791
  runtime: "onnxruntime-web@1.27.0",
4788
4792
  notes: [
4789
- "about 2 GB by an earlier bench's label (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
4793
+ "about 2 GB (vendor); the repo, its file paths and its input dtypes are inferred and not checked",
4790
4794
  "runs the unet twice a step for guidance, so a step costs about twice an sd-turbo step (inferred)",
4791
4795
  "tokenizer: Xenova/clip-vit-base-patch16 through transformers.js (CLIP weights MIT)"
4792
4796
  ],
@@ -4843,7 +4847,7 @@ const IMAGEGEN_PICKER_RECORDS = [{
4843
4847
  commercial: "unknown",
4844
4848
  place: "gpu",
4845
4849
  runtime: "onnxruntime-web@1.27.0",
4846
- 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"],
4850
+ 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"],
4847
4851
  form: {
4848
4852
  steps: {
4849
4853
  min: 1,
@@ -4887,6 +4891,7 @@ function toTxt(segs) {
4887
4891
  function cueText(t) {
4888
4892
  return t.replace(/-->/g, "->").replace(/\n\s*\n/g, "\n");
4889
4893
  }
4894
+ /** SubRip text: numbered cues with comma millisecond stamps. */
4890
4895
  function toSrt(segs) {
4891
4896
  return segs.map((s, i) => `${i + 1}\n${timestamp(s.start, true)} --> ${timestamp(s.end, true)}\n${cueText(s.text)}\n`).join("\n");
4892
4897
  }
@@ -4900,6 +4905,7 @@ function toSrt(segs) {
4900
4905
  return t;
4901
4906
  })();
4902
4907
  // packages/speak/src/records.ts
4908
+ /** Model records for the voices this package drives, for pickers and the models registry. */
4903
4909
  const SPEAK_RECORDS = [
4904
4910
  {
4905
4911
  id: "kokoro-82m",
@@ -4924,7 +4930,7 @@ const SPEAK_RECORDS = [
4924
4930
  commercial: true,
4925
4931
  place: "cpu-worker",
4926
4932
  runtime: "kokoro-js@1.2.1",
4927
- 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"]
4933
+ notes: ["webgpu with q8 has given garbled audio", "fp32 weights (about 330 MB, inferred) do not cache on file://, so webgpu needs http"]
4928
4934
  },
4929
4935
  {
4930
4936
  id: "pocket-tts",
@@ -4992,8 +4998,7 @@ const SPEAK_RECORDS = [
4992
4998
  // packages/transcribe/src/records.ts
4993
4999
  /**
4994
5000
  * Speech to text records for the models hub. Ladders and dtypes are
4995
- * the earlier transcription tool's per model table; sizes are inferred from the builds'
4996
- * notes, except rows marked vendor: those sum the quantized encoder and
5001
+ * one per model table; sizes are inferred from the model notes, except rows marked vendor: those sum the quantized encoder and
4997
5002
  * decoder in the hub listing (no download, 2026-11-25), in MiB. Licences are the model cards' as of 2026-11-22.
4998
5003
  */
4999
5004
  const asr = (r) => ({
@@ -5005,6 +5010,7 @@ const asr = (r) => ({
5005
5010
  runtime: "@huggingface/transformers@4.3.2",
5006
5011
  ...r
5007
5012
  });
5013
+ /** The Whisper and Moonshine model records for the models hub. */
5008
5014
  const TRANSCRIBE_RECORDS = [
5009
5015
  asr({
5010
5016
  id: "whisper-large-v3-turbo",
@@ -5018,7 +5024,7 @@ const TRANSCRIBE_RECORDS = [
5018
5024
  ladder: LADDERS.whisperTurbo(),
5019
5025
  licence: "MIT",
5020
5026
  place: "gpu",
5021
- 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)"]
5027
+ 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)"]
5022
5028
  }),
5023
5029
  asr({
5024
5030
  id: "whisper-base",
@@ -5055,7 +5061,7 @@ const TRANSCRIBE_RECORDS = [
5055
5061
  sizeMB: 90,
5056
5062
  ladder: LADDERS.whisperSmall(false),
5057
5063
  licence: "MIT (the OpenAI Whisper release; the Xenova ONNX card says apache-2.0)",
5058
- notes: ["english only; the earlier transcription tool's no gpu default"]
5064
+ notes: ["english only; the default with no gpu"]
5059
5065
  }),
5060
5066
  asr({
5061
5067
  id: "whisper-tiny.en",
@@ -5096,15 +5102,15 @@ const TRANSCRIBE_RECORDS = [
5096
5102
  ];
5097
5103
  // packages/transcribe/src/export.ts
5098
5104
  /**
5099
- * Transcript exports in the earlier transcription tool's layouts: txt, srt,
5105
+ * Transcript exports as txt, srt,
5100
5106
  * vtt and json per file, and one store only zip with four files per
5101
5107
  * source plus `manifest.json`. The manifest records the model and language
5102
- * of each file's own run (the earlier tool wrote the select values at
5103
- * export time, which could differ from the run). A speaker label, when a
5108
+ * of each file's own run. A speaker label, when a
5104
5109
  * person set one, leads the line in txt and srt and is a voice tag in vtt.
5105
5110
  */
5106
5111
  const said = (s) => s.speaker ? `${s.speaker}: ${s.text}` : s.text;
5107
5112
  const r3 = (x) => +x.toFixed(3);
5113
+ /** Plain text with speaker labels leading their lines; a gap over 2 s starts a paragraph. */
5108
5114
  function asTxt(segs) {
5109
5115
  return toTxt(segs.map((s) => ({
5110
5116
  start: s.start,
@@ -5112,6 +5118,7 @@ function asTxt(segs) {
5112
5118
  text: said(s)
5113
5119
  })));
5114
5120
  }
5121
+ /** SubRip text with speaker labels leading their lines. */
5115
5122
  function asSrt(segs) {
5116
5123
  return toSrt(segs.map((s) => ({
5117
5124
  start: s.start,
@@ -5120,6 +5127,7 @@ function asSrt(segs) {
5120
5127
  })));
5121
5128
  }
5122
5129
  const esc$1 = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
5130
+ /** WebVTT text with speakers as voice tags and cue text escaped. */
5123
5131
  function asVtt(segs) {
5124
5132
  const cue = (s) => {
5125
5133
  const body = esc$1(s.text.replace(/-->/g, "->").replace(/\n\s*\n/g, "\n"));
@@ -5175,6 +5183,7 @@ function baseName(name) {
5175
5183
  * only for a URL the app supplies; YOLOv10 n, s and m, FastSAM and the face
5176
5184
  * swap set sit in PICKER_RECORDS.
5177
5185
  */
5186
+ /** The MediaPipe model storage base URL the MediaPipe records load from. */
5178
5187
  const MP_MODELS = "https://storage.googleapis.com/mediapipe-models/";
5179
5188
  /** MediaPipe ladder: GPU delegate (webgl), then the CPU delegate (wasm). */
5180
5189
  const mediapipeLadder = () => [{ device: "webgl" }, { device: "wasm" }];
@@ -5195,6 +5204,7 @@ const mp = (id, provides, path, sizeMB, label, verdict = "light, on the gpu", gr
5195
5204
  place: "main",
5196
5205
  runtime: "@mediapipe/tasks-vision@1.2.3"
5197
5206
  });
5207
+ /** The vision records registered by `attachVision`: Depth Anything V2 small, MediaPipe detection, segmentation and landmarks, SlimSAM, SmolVLM 256M and LFM2-VL 450M. */
5198
5208
  const VISION_RECORDS = [
5199
5209
  {
5200
5210
  id: "depth-anything-v2-small",
@@ -5212,7 +5222,7 @@ const VISION_RECORDS = [
5212
5222
  commercial: true,
5213
5223
  place: "cpu-worker",
5214
5224
  runtime: "@huggingface/transformers@4.3.2",
5215
- notes: ["earlier builds: fp16 on webgpu, fp32 on the same device after a failure"]
5225
+ notes: ["fp16 on webgpu, fp32 on the same device after a failure"]
5216
5226
  },
5217
5227
  mp("efficientdet-lite0", "detect", "object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite", 7, "mediapipe efficientdet lite0 (coco, 80 classes)", "light, 80 things"),
5218
5228
  mp("selfie-segmenter", "segment.person", "image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.tflite", 1, "mediapipe selfie segmenter"),
@@ -5244,7 +5254,7 @@ const VISION_RECORDS = [
5244
5254
  commercial: true,
5245
5255
  place: "cpu-worker",
5246
5256
  runtime: "@huggingface/transformers@4.3.2",
5247
- notes: ["earlier builds: one image embedding, then any number of point prompts"]
5257
+ notes: ["one image embedding, then any number of point prompts"]
5248
5258
  },
5249
5259
  {
5250
5260
  id: "smolvlm-256m-instruct",
@@ -5287,13 +5297,12 @@ const VISION_RECORDS = [
5287
5297
  commercial: "unknown",
5288
5298
  place: "gpu",
5289
5299
  runtime: "@huggingface/transformers@4.3.2",
5290
- notes: ["earlier builds: q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
5300
+ notes: ["q4f16 on webgpu only; the licence limits commercial use by revenue, read it before shipping"]
5291
5301
  }
5292
5302
  ];
5293
5303
  /**
5294
5304
  * Records listed for pickers and never registered by default, so a hub's
5295
- * routing by capability keeps its small defaults: larger alternates the
5296
- * earlier tools offered (smolvlm 500m and 2 video, gemma 4 e2b, two more
5305
+ * routing by capability keeps its small defaults: larger alternates (smolvlm 500m and 2 video, gemma 4 e2b, two more
5297
5306
  * depth models), and records under licences that limit use (YOLOv10 and
5298
5307
  * FastSAM are AGPL-3.0 upstream, Ultralytics; the face swap set is
5299
5308
  * InsightFace, non-commercial). A hub that runs one adds it itself. Sizes
@@ -5327,8 +5336,9 @@ const yolo10 = (size, mb, speed, verdict) => ({
5327
5336
  licence: "AGPL-3.0 (Ultralytics weights, the model card's licence field)",
5328
5337
  commercial: false,
5329
5338
  place: "gpu",
5330
- 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"]
5339
+ 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"]
5331
5340
  });
5341
+ /** Records listed for pickers and never registered by default: larger alternates, and records under licences that limit use (YOLOv10, FastSAM, the face swap set). */
5332
5342
  const PICKER_RECORDS = [
5333
5343
  {
5334
5344
  id: "smolvlm-500m-instruct",
@@ -5371,7 +5381,7 @@ const PICKER_RECORDS = [
5371
5381
  commercial: true,
5372
5382
  place: "cpu-worker",
5373
5383
  runtime: "@huggingface/transformers@4.3.2",
5374
- notes: ["an earlier room offered it beside smolvlm 256m and 500m"]
5384
+ notes: ["an option beside smolvlm 256m and 500m"]
5375
5385
  },
5376
5386
  {
5377
5387
  id: "depth-anything-v2-base",
@@ -5428,7 +5438,7 @@ const PICKER_RECORDS = [
5428
5438
  commercial: true,
5429
5439
  place: "gpu",
5430
5440
  runtime: "@huggingface/transformers@4.3.2",
5431
- notes: ["an earlier dog sim used it as the cortex at about 3.3 GB (vendor there)"]
5441
+ notes: ["about 3.3 GB (vendor)"]
5432
5442
  },
5433
5443
  yolo10("n", 9, "instant", "nano, quick"),
5434
5444
  yolo10("s", 28, "fast", "small, sharper"),
@@ -5457,7 +5467,7 @@ const PICKER_RECORDS = [
5457
5467
  licence: "AGPL-3.0 upstream (Ultralytics FastSAM); the export's card says apache-2.0",
5458
5468
  commercial: false,
5459
5469
  place: "cpu-worker",
5460
- 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"]
5470
+ notes: ["finds every mask in one pass on onnxruntime-web (93 MB, vendor)", "segment everything: prototype masks, nms, then a pick by click"]
5461
5471
  },
5462
5472
  {
5463
5473
  id: "scrfd-10g",
@@ -5530,7 +5540,7 @@ const PICKER_RECORDS = [
5530
5540
  licence: "InsightFace: non-commercial research only; the mirror's card says gpl-3.0",
5531
5541
  commercial: false,
5532
5542
  place: "gpu",
5533
- notes: ["128 px faces; an earlier face swap tool pasted the result back with a feathered mask"]
5543
+ notes: ["128 px faces; paste the result back with a feathered mask"]
5534
5544
  }
5535
5545
  ];
5536
5546
  /** A face landmark fallback record over face-api.js tiny nets (code MIT; weights MIT from @vladmandic/face-api). */
@@ -5559,9 +5569,10 @@ function faceApiRecord(baseUrl) {
5559
5569
  * records come from the packages that run them; a record listed in more
5560
5570
  * than one place counts once, the running package's copy first.
5561
5571
  */
5562
- /** face-api weights (MIT) as an earlier face swap tool loaded them, from the package CDN. */
5572
+ /** Base URL of the face-api weights (MIT) on the package CDN. */
5563
5573
  const FACE_API_BASE = "https://cdn.jsdelivr.net/npm/@vladmandic/face-api@1.7.12/model/";
5564
5574
  const has = (...want) => (caps) => caps.some((c) => want.includes(c));
5575
+ /** The words and capability test of every job. */
5565
5576
  const JOBS = {
5566
5577
  chat: {
5567
5578
  label: "brain",
@@ -5630,6 +5641,7 @@ const JOBS = {
5630
5641
  provides: has("landmarks.face", "landmarks.hand", "landmarks.pose", "landmarks.gesture")
5631
5642
  }
5632
5643
  };
5644
+ /** Every job name, in the order of `JOBS`. */
5633
5645
  const JOB_NAMES = Object.keys(JOBS);
5634
5646
  /** Every record the views know, the running package's copy of a duplicate first. */
5635
5647
  const ALL_RECORDS = (() => {
@@ -5657,6 +5669,7 @@ function jobRecords(job, records = ALL_RECORDS) {
5657
5669
  const def = JOBS[job];
5658
5670
  return records.filter((r) => def.provides(r.provides));
5659
5671
  }
5672
+ /** Whether a string is a job name. */
5660
5673
  function isJob(s) {
5661
5674
  return !!s && s in JOBS;
5662
5675
  }
@@ -5727,9 +5740,11 @@ const GROUPS = {
5727
5740
  "no download": "none",
5728
5741
  own: "own"
5729
5742
  };
5743
+ /** Whether a record has nothing to download: a built in, system or zero size model. */
5730
5744
  function isNoDownload(r) {
5731
5745
  return !!r.noDownload || r.sizeMB === 0 || r.provider === "prompt-api" || r.provider === "system";
5732
5746
  }
5747
+ /** Whether a record's censorship is "uncensored" or "abliterated". */
5733
5748
  function isUncensored(r) {
5734
5749
  return r.censorship === "uncensored" || r.censorship === "abliterated";
5735
5750
  }
@@ -5905,6 +5920,10 @@ function weightKeys(rec) {
5905
5920
  const files = s.files?.length ? s.files.map((f) => f.path) : s.file ? [s.file] : [];
5906
5921
  return base ? files.map((f) => base + f) : [];
5907
5922
  }
5923
+ /**
5924
+ * A loader that fetches a record's weight files through a weight store; records that load through
5925
+ * their runtime throw.
5926
+ */
5908
5927
  function weightsLoader(store) {
5909
5928
  return async (rec, { signal, onProgress }) => {
5910
5929
  if (rec.noDownload || rec.sizeMB === 0) {
@@ -6012,6 +6031,7 @@ function defaultPick(records, env, estimate) {
6012
6031
  }).unfit === void 0);
6013
6032
  return (fits.find((r) => r.group === "start here") ?? fits.find((r) => r.speed === "fast" || r.speed === "steady") ?? fits[0] ?? records[0])?.id ?? "";
6014
6033
  }
6034
+ /** Creates a model picker for a job, with rows that say whether each model fits this machine. */
6015
6035
  function useModelPick(job, o = {}) {
6016
6036
  const def = JOBS[job];
6017
6037
  let records = jobRecords(job, o.records ?? ALL_RECORDS);
@@ -6151,6 +6171,7 @@ function useModelPick(job, o = {}) {
6151
6171
  error: (id) => errors.get(id)
6152
6172
  };
6153
6173
  }
6174
+ /** Creates one picker per job and joins them as a rack with presets and load all. */
6154
6175
  function useJobsPick(jobs, initialPresets = [], shared = {}) {
6155
6176
  let presets = initialPresets;
6156
6177
  const extra = /* @__PURE__ */ new Set();
@@ -6204,7 +6225,9 @@ function useJobsPick(jobs, initialPresets = [], shared = {}) {
6204
6225
  };
6205
6226
  }
6206
6227
  // packages/ai-views/src/chat.ts
6228
+ /** What a reply says when no chat engine is set. */
6207
6229
  const NO_ENGINE = "this needs a model. pick one in the bar and load it.";
6230
+ /** Creates a chat thread that streams replies from an engine, with optional memory recall per message. */
6208
6231
  function chatThread(o = {}) {
6209
6232
  let engine = o.engine ?? null;
6210
6233
  const now = o.now ?? (() => Date.now());
@@ -6357,6 +6380,10 @@ function chatThread(o = {}) {
6357
6380
  }
6358
6381
  };
6359
6382
  }
6383
+ /**
6384
+ * Creates a list of chat threads, newest first, with one open; its `thread` always speaks for the
6385
+ * open chat.
6386
+ */
6360
6387
  function chatList(o = {}) {
6361
6388
  const now = o.now ?? (() => Date.now());
6362
6389
  let engine = o.engine ?? null;
@@ -6481,8 +6508,7 @@ function contextSegments(s, system = "") {
6481
6508
  }
6482
6509
  // packages/ai-views/src/transcribe.ts
6483
6510
  /**
6484
- * The state behind TranscribeDrop and TranscriptView, after the earlier
6485
- * transcription tool: drop files, they queue as channels, run one at a
6511
+ * The state behind TranscribeDrop and TranscriptView: drop files, they queue as channels, run one at a
6486
6512
  * time, and each becomes a transcript with timestamps that a person can
6487
6513
  * edit (with undo) and export as txt, srt, vtt or json. The engine is a
6488
6514
  * function the page passes, so a stub runs the view with no weights.
@@ -6493,6 +6519,7 @@ const TYPES = {
6493
6519
  vtt: "text/vtt",
6494
6520
  json: "application/json"
6495
6521
  };
6522
+ /** Creates a transcribe queue that runs each file through `run`, one at a time. */
6496
6523
  function transcribeQueue(o) {
6497
6524
  let run = o.run;
6498
6525
  let channels = [];
@@ -6756,6 +6783,7 @@ svg("<path d=\"M9 14 4 9l5-5\"/><path d=\"M4 9h10a6 6 0 0 1 0 12h-3\"/>"), svg("
6756
6783
  // packages/ai-views/src/memory.ts
6757
6784
  const n3 = (x) => Number.isFinite(x) ? x.toFixed(3) : "none";
6758
6785
  const rank = (r) => r >= 0 ? `#${r + 1}` : "none";
6786
+ /** The rows of a recall trace as text, marking the hits handed to the model. */
6759
6787
  function traceRows(r, maxText = 80) {
6760
6788
  const used = new Set(r.hits.map((h) => h.item.id));
6761
6789
  return r.trace.map((t, i) => ({
@@ -6770,6 +6798,7 @@ function traceRows(r, maxText = 80) {
6770
6798
  used: used.has(t.id)
6771
6799
  }));
6772
6800
  }
6801
+ /** The HTML of a recall trace table, or an empty note before any recall. */
6773
6802
  function inspectorHtml(rec) {
6774
6803
  if (!rec) return `<p class="hb-lay-empty-note">no recall yet. ask something to see what memory finds.</p>`;
6775
6804
  const rows = traceRows(rec);