@polycode-projects/the-mechanical-code-talker 5.0.34 → 5.0.35
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.
|
@@ -139,6 +139,8 @@ ${THEME_TOKENS_CSS}
|
|
|
139
139
|
.item .paragraph { margin: .4rem 0; }
|
|
140
140
|
.item .sources-links { font-size: .74rem; color: var(--muted); }
|
|
141
141
|
.item details.facts summary { font-family: ${MONO_STACK}; font-size: .68rem; color: var(--corpus); cursor: pointer; }
|
|
142
|
+
.item details.background summary { font-family: ${MONO_STACK}; font-size: .68rem; color: var(--muted); cursor: pointer; }
|
|
143
|
+
.item details.background p { margin: .35rem 0 0; color: var(--muted); }
|
|
142
144
|
.item .factrow { font-family: ${MONO_STACK}; font-size: .68rem; padding: .15rem 0; border-bottom: 1px dotted var(--line); }
|
|
143
145
|
.item .facttriple { font-family: ${MONO_STACK}; font-size: .62rem; color: var(--muted); padding-left: .6rem; }
|
|
144
146
|
.empty { color: var(--muted); font-size: .85rem; border: 1px dashed var(--line); border-radius: 6px; padding: .8rem 1rem; }
|
|
@@ -432,9 +434,13 @@ const SEED_BYTES = ${Number(seedBytes) || 0};
|
|
|
432
434
|
const seedTag = feed.seedFallback ? '<span class="seedtag">from the seed graph — start to poll live sources</span>' : "";
|
|
433
435
|
const sourcesText = item.sources.map((s) => esc(s.title || s.url)).join(", ");
|
|
434
436
|
const facts = await factListHtml(item.factIds);
|
|
437
|
+
const background = item.backgroundParagraph
|
|
438
|
+
? '<details class="background"><summary>what the graph already knew</summary><p>' + esc(item.backgroundParagraph) + '</p></details>'
|
|
439
|
+
: "";
|
|
435
440
|
card.innerHTML =
|
|
436
441
|
'<span class="hub">' + esc(item.hub) + '</span><span class="tier">' + esc(item.tier || "unranked") + '</span>' + seedTag
|
|
437
442
|
+ '<p class="paragraph">' + esc(item.paragraph) + '</p>'
|
|
443
|
+
+ background
|
|
438
444
|
+ (sourcesText ? '<p class="sources-links">sources: ' + sourcesText + '</p>' : "")
|
|
439
445
|
+ '<details class="facts"><summary>' + item.factIds.length + ' facts</summary>' + facts + '</details>';
|
|
440
446
|
cardsByItemId.set(item.id, card);
|
package/src/services/news.mjs
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
import { normFactTerm, normFactPredicate, factIdFor, sha256Bytes } from "../domain/hash.mjs";
|
|
41
41
|
import {
|
|
42
42
|
newsWindowRows, scoreHubs, subgraphAround, buildTermAdjacency, renderNewsParagraph, buildNewsItems, evictNewsFacts,
|
|
43
|
+
conceptTerms, isQuantityTerm,
|
|
43
44
|
} from "../domain/news-feed.mjs";
|
|
44
45
|
import {
|
|
45
46
|
createTermLedger, bumpTerms, rankedTerms, markTerm, groundedSweep, ledgerPayload, ledgerFromPayload,
|
|
@@ -291,9 +292,19 @@ function collectItemSources(subgraphRows, sourcesByFactId) {
|
|
|
291
292
|
/** The item-assembly buildNewsItems runs internally, exposed here so
|
|
292
293
|
* buildFeed's seed-only fallback (S1: score hubs over the WHOLE graph, not
|
|
293
294
|
* just news/research-tagged rows) can reuse the same shape without widening
|
|
294
|
-
* buildNewsItems's own, already-pinned window contract.
|
|
295
|
+
* buildNewsItems's own, already-pinned window contract.
|
|
296
|
+
*
|
|
297
|
+
* The newsworthiness gate's test 2 only (PLAN_NEWS_FEED.md section 17.6): a
|
|
298
|
+
* seed-only graph carries no news rows at all, so tests 1 (reported) and 3
|
|
299
|
+
* (anchored) have nothing to read — every candidate would fail them
|
|
300
|
+
* trivially and empty the page, which is exactly the fallback exists to
|
|
301
|
+
* prevent. Dropping class and bare-quantity terms still holds: neither ever
|
|
302
|
+
* makes a good card title, seed graph or not. */
|
|
295
303
|
function assembleNewsItems(rows, windowRows, { now, limit, sourcesByFactId }) {
|
|
296
|
-
const
|
|
304
|
+
const concepts = conceptTerms(rows);
|
|
305
|
+
const candidates = scoreHubs(rows, windowRows, { limit: Infinity })
|
|
306
|
+
.filter(({ term }) => !concepts.has(term) && !isQuantityTerm(term));
|
|
307
|
+
const hubs = candidates.slice(0, limit);
|
|
297
308
|
const adjacency = buildTermAdjacency(rows);
|
|
298
309
|
const items = hubs.map(({ term, changed }) => {
|
|
299
310
|
const subgraphRows = subgraphAround(rows, term, { adjacency });
|
|
@@ -307,6 +318,8 @@ function assembleNewsItems(rows, windowRows, { now, limit, sourcesByFactId }) {
|
|
|
307
318
|
paragraph: renderNewsParagraph(term, subgraphRows),
|
|
308
319
|
tier: tierOfRows(subgraphRows),
|
|
309
320
|
sources: collectItemSources(subgraphRows, sourcesByFactId),
|
|
321
|
+
background: [],
|
|
322
|
+
backgroundParagraph: "",
|
|
310
323
|
};
|
|
311
324
|
});
|
|
312
325
|
return items.sort((a, b) => (toMs(b.builtAt) - toMs(a.builtAt)) || byId(a, b));
|
|
@@ -784,7 +797,8 @@ function renderFeedText(feed, focus) {
|
|
|
784
797
|
const seedTag = feed.seedFallback ? " (from the seed graph — start to poll live sources)" : "";
|
|
785
798
|
const sourceNames = it.sources.map((s) => s.title || s.url).filter(Boolean);
|
|
786
799
|
const sourcesText = sourceNames.length ? ` sources: ${sourceNames.join(", ")}` : "";
|
|
787
|
-
|
|
800
|
+
const backgroundText = it.backgroundParagraph ? ` what the graph already knew: ${it.backgroundParagraph}` : "";
|
|
801
|
+
return `${i + 1}. ${it.paragraph} (${it.tier || "unranked"})${sourcesText}${seedTag}${backgroundText}`;
|
|
788
802
|
})
|
|
789
803
|
.join("\n");
|
|
790
804
|
}
|