@polycode-projects/the-mechanical-code-talker 5.0.31 → 5.0.33

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.
@@ -107,9 +107,10 @@ ${THEME_TOKENS_CSS}
107
107
  select, .urlinput { font-family: ${MONO_STACK}; font-size: .72rem; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .55rem; }
108
108
  .urlinput { flex: 1 1 12rem; min-width: 8rem; }
109
109
  .sources { display: flex; flex-direction: column; gap: .3rem; margin: .6rem 0; }
110
- .sourcerow { display: flex; align-items: center; gap: .5rem; font-size: .78rem; padding: .25rem .1rem; }
110
+ .sourcerow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .78rem; padding: .25rem .1rem; min-width: 0; }
111
111
  .sourcerow.kb { opacity: .85; }
112
112
  .sourcename { min-width: 12rem; }
113
+ @media (max-width: 480px) { .sourcename { min-width: 0; } .sourcestatus { flex-basis: 100%; } }
113
114
  .sourcehome { font-family: ${MONO_STACK}; font-size: .66rem; color: var(--corpus); }
114
115
  .sourcestatus { margin-left: auto; font-family: ${MONO_STACK}; font-size: .66rem; color: var(--muted); }
115
116
  .reqlog { margin-bottom: 1rem; }
@@ -366,6 +367,10 @@ const SEED_BYTES = ${Number(seedBytes) || 0};
366
367
  }
367
368
 
368
369
  async function renderAll() {
370
+ // Chips and tiles are cheap synchronous text writes; they lead so a
371
+ // just-finished poll reads back immediately while the feed's own slower,
372
+ // yielding render catches up behind it.
373
+ renderSourcesPanel();
369
374
  await Promise.all([renderFeed(), renderRank(), renderRequestLog()]);
370
375
  renderSourcesPanel();
371
376
  window.tmct.news = Object.assign({}, window.tmct.news, {
@@ -379,20 +384,32 @@ const SEED_BYTES = ${Number(seedBytes) || 0};
379
384
  async function boot() {
380
385
  window.tmct.news = { phase: "seeding", metrics: { timeToFirstArticleMs: null, timeToFirstCompletePollMs: null }, nextPollAt: "" };
381
386
  appendLog("phase: seeding");
387
+ // The wink vendor is what lets ingested prose ground at all — without it
388
+ // every extract runs lexicon-blind and the whole enrich loop misses.
389
+ // Loaded alongside the seed, tolerated as absent the same way chat.html
390
+ // tolerates it, never blocking the page.
391
+ const winkLoad = (async function () {
392
+ try {
393
+ const mod = await Promise.race([
394
+ import("./vendor/wink.js"),
395
+ new Promise(function (resolve, reject) { setTimeout(function () { reject(new Error("wink vendor load timed out")); }, 20000); }),
396
+ ]);
397
+ window.tmct.page.registerWinkModel(function () { return { winkNLP: mod.winkNLP, model: mod.model }; });
398
+ appendLog("wink vendor loaded — prose grounding armed");
399
+ } catch (err) {
400
+ appendLog("wink vendor unavailable — prose grounding runs lexicon-blind");
401
+ }
402
+ })();
382
403
  const outcome = await loadSeedPayload(fetchWithProgress, "./chat-seed.json", SEED_QUERY, function () {});
383
404
  window.tmct.seed = { state: outcome.status.state, facts: outcome.status.facts };
405
+ await winkLoad;
384
406
  await window.tmct.open({ seedPayload: outcome.payload, vocabSeeded: Boolean(outcome.payload) });
385
- window.tmct.news.phase = "seeded";
386
- appendLog("phase: seeded");
387
- await renderAll();
388
407
 
408
+ // Every control binds before the phase flips to "seeded": the first feed
409
+ // render is deliberately slow (it yields per card), and a click that
410
+ // lands in that window must already have its listener.
389
411
  const startBtn = el("newsStart");
390
- const consented = window.tmct.session.consented;
391
- startBtn.textContent = consented ? "poll now" : "start polling live sources";
392
- if (consented) {
393
- await window.tmct.session.start();
394
- await renderAll();
395
- }
412
+ startBtn.textContent = window.tmct.session.consented ? "poll now" : "start polling live sources";
396
413
 
397
414
  startBtn.addEventListener("click", async function () {
398
415
  startBtn.disabled = true;
@@ -425,7 +442,7 @@ const SEED_BYTES = ${Number(seedBytes) || 0};
425
442
  document.querySelectorAll("[data-source-toggle]").forEach(function (box) {
426
443
  box.addEventListener("change", function () {
427
444
  const ids = [].slice.call(document.querySelectorAll("[data-source-toggle]:checked")).map(function (b) { return b.value; });
428
- window.tmct.session.config.sources = ids;
445
+ window.tmct.session.setSources(ids);
429
446
  renderSourcesPanel();
430
447
  });
431
448
  });
@@ -473,6 +490,14 @@ const SEED_BYTES = ${Number(seedBytes) || 0};
473
490
  el("teachStatus").textContent = "loaded " + file.name + " — press ingest";
474
491
  el("teachFile").dataset.name = file.name;
475
492
  });
493
+
494
+ window.tmct.news.phase = "seeded";
495
+ appendLog("phase: seeded");
496
+ await renderAll();
497
+ if (window.tmct.session.consented) {
498
+ await window.tmct.session.start();
499
+ await renderAll();
500
+ }
476
501
  el("teachIngest").addEventListener("click", async function () {
477
502
  const text = el("teachText").value;
478
503
  if (!text.trim()) return;
@@ -46,6 +46,7 @@ import {
46
46
  } from "../domain/term-ledger.mjs";
47
47
  import { syllogise } from "../domain/syllogise.mjs";
48
48
  import { loadLexicon, lookupNoun } from "../domain/grammar/lexicon.mjs";
49
+ import { pluralOf } from "../domain/inflect.mjs";
49
50
  import { provenanceTagToSource, SOURCE_PRIOR } from "../domain/memory/trust.mjs";
50
51
  import {
51
52
  NEWS_SOURCE_RECORDS, DEFAULT_NEWS_SOURCE_IDS, DEFAULT_NEWS_KB_IDS,
@@ -365,7 +366,7 @@ async function ingestSnapshotFacts(ctx, snapshot) {
365
366
  const lex = lexicon || loadLexicon();
366
367
  const text = joinTitleAndSummary(snapshot.title, snapshot.summary);
367
368
  const sourceTag = `news:${snapshot.sourceId}@${snapshot.id}`;
368
- const result = await ingestText(text, { memoryDir, sourceTag, optimistic: true, lexicon: lex });
369
+ const result = await ingestText(text, { memoryDir, sourceTag, optimistic: true, lexicon: lex, observedAt: nowVal });
369
370
  invalidateCache(cache);
370
371
 
371
372
  const allFacts = [...result.extracted, ...result.optimistic];
@@ -768,7 +769,7 @@ export function ingestUploadedFactRows(rows, { fileLabel, now } = {}) {
768
769
  const NEWS_USAGE = "usage: /news [poll|rank|enrich|sources|add <url>|interval <minutes>]";
769
770
 
770
771
  function pluralize(n, word) {
771
- return `${n} ${word}${n === 1 ? "" : "s"}`;
772
+ return `${n} ${n === 1 ? word : pluralOf(word)}`;
772
773
  }
773
774
 
774
775
  function renderFeedText(feed, focus) {