@mrclrchtr/supi-web 2.8.0 → 3.1.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "2.8.0",
3
+ "version": "3.1.0",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -55,6 +55,7 @@
55
55
  "./config": "./src/config.ts",
56
56
  "./context": "./src/context.ts",
57
57
  "./debug": "./src/debug-registry.ts",
58
+ "./evidence-badge": "./src/evidence-badge.ts",
58
59
  "./footer-registry": "./src/footer-registry.ts",
59
60
  "./llm": "./src/llm.ts",
60
61
  "./model-selection": "./src/model-selection.ts",
@@ -15,6 +15,8 @@ export * from "./context.ts";
15
15
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
16
16
  export * from "./debug-registry.ts";
17
17
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
+ export * from "./evidence-badge.ts";
19
+ // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
20
  export * from "./footer-registry.ts";
19
21
  // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
20
22
  export * from "./llm.ts";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * TUI-facing evidence badge string formatter.
3
+ *
4
+ * Pure string formatting — no pi-tui dependency. Consumes evidence
5
+ * completeness metadata and produces compact human-readable badges.
6
+ */
7
+
8
+ /** Metadata describing how many evidence atoms were shown vs exist. */
9
+ export interface EvidenceBadgeInput {
10
+ shownCount: number;
11
+ totalCount: number | null;
12
+ omittedCount: number | null;
13
+ partialReason: string | null;
14
+ /** Human-readable label for the badge, e.g. "references", "symbols". */
15
+ label: string;
16
+ }
17
+
18
+ /**
19
+ * Format a compact evidence completeness badge.
20
+ *
21
+ * | Input | Output |
22
+ * |------------------------------------------------------|---------------------------------------|
23
+ * | shown=12, total=12, omitted=0, label="references" | `12 references` |
24
+ * | shown=8, total=20, omitted=12, label="symbols" | `8 of 20 symbols (12 omitted)` |
25
+ * | shown=5, total=null, reason="timeout", label="matches" | `5 matches — timeout` |
26
+ */
27
+ export function formatEvidenceBadge(input: EvidenceBadgeInput): string {
28
+ const { shownCount, totalCount, omittedCount, partialReason, label } = input;
29
+
30
+ if (totalCount === null) {
31
+ const reasonSuffix = partialReason ? ` — ${partialReason}` : "";
32
+ return `${shownCount} ${label}${reasonSuffix}`;
33
+ }
34
+
35
+ if (omittedCount !== null && omittedCount > 0) {
36
+ return `${shownCount} of ${totalCount} ${label} (${omittedCount} omitted)`;
37
+ }
38
+
39
+ return `${shownCount} ${label}`;
40
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-web",
3
- "version": "2.8.0",
3
+ "version": "3.1.0",
4
4
  "description": "SuPi Web extension — fetch web pages as clean Markdown (web_fetch_md) and library docs via Context7 (web_docs_search, web_docs_fetch)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "@mozilla/readability": "^0.6.0",
37
37
  "turndown": "^7.2.0",
38
38
  "turndown-plugin-gfm": "^1.0.2",
39
- "@mrclrchtr/supi-core": "2.8.0"
39
+ "@mrclrchtr/supi-core": "3.1.0"
40
40
  },
41
41
  "bundledDependencies": [
42
42
  "@mrclrchtr/supi-core"