@adia-ai/a2ui-retrieval 0.2.1 → 0.2.3

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,53 @@ _Nothing yet._
9
9
 
10
10
  ---
11
11
 
12
+ ## [0.2.3] - 2026-05-04
13
+
14
+ **Lockstep cut.** All 8 published `@adia-ai/*` packages bump
15
+ 0.2.2 → 0.2.3 per
16
+ [`docs/specs/package-architecture.md` § 15](../../../../docs/specs/package-architecture.md#15-versioning-policy).
17
+ Patch cut — no breaking changes.
18
+
19
+ ### Changed
20
+
21
+ - `version`: `0.2.2` → `0.2.3`.
22
+ - `dependencies["@adia-ai/a2ui-corpus"]`: `^0.2.0` (covers `0.2.3`).
23
+
24
+ ### No source changes
25
+
26
+ `@adia-ai/a2ui-retrieval` source is byte-identical to `0.2.2`. The cut bumps version + the internal dep range entries only.
27
+
28
+ ## [0.2.2] - 2026-05-02
29
+
30
+ **Lockstep cut + `detectReferences` brand-only filter.** All 8 published `@adia-ai/*` packages bump 0.2.1 → 0.2.2 per [`docs/specs/package-architecture.md` § 15](../../../docs/specs/package-architecture.md#15-versioning-policy). Patch cut — no breaking changes.
31
+
32
+ ### Changed
33
+
34
+ - `version`: `0.2.1` → `0.2.2`.
35
+ - `dependencies["@adia-ai/a2ui-corpus"]`: `^0.2.0` (covers `0.2.2`).
36
+ - `dependencies["@adia-ai/a2ui-utils"]`: `^0.2.0` (covers `0.2.2`).
37
+ - `authoring/web-research.js` is the surface that gained the EXPLICIT/IMPLICIT pattern split; no other retrieval subdirs touched.
38
+
39
+ ### Fixed — `detectReferences` brand-only filter (2026-05-02)
40
+
41
+ `authoring/web-research.js` regex patterns were capturing generic nouns as brand references. For the intent `"tier pricing page"`, the pattern `\b(\w+)\s+(?:pricing|dashboard|landing|login|settings|profile)\s+page\b` captured `"tier"` and seeded a research query for `"tier pricing UI design components"` — useless, since `"tier"` is a generic noun, not a brand reference.
42
+
43
+ Fix: split `REFERENCE_PATTERNS` into two tiers by signal strength:
44
+
45
+ - **`EXPLICIT_PATTERNS`** — the surrounding language declares the captured token IS a brand reference (`"like X"`, `"X-style"`, `"similar to X"`, `"clone X"`). Captures accepted as references.
46
+ - **`IMPLICIT_PATTERNS`** — the surrounding language is a UI-shape verb (`"X pricing page"`). Captures accepted ONLY if in `KNOWN_REFERENCES` (Stripe, Notion, Figma, …); generic nouns dropped.
47
+
48
+ Verified:
49
+ - `"tier pricing page"` → no refs (was: `["tier"]`)
50
+ - `"fancy pricing page"` → no refs
51
+ - `"Stripe pricing page"` → `["stripe"]` ✓
52
+ - `"Notion-style sidebar"` → `["notion"]` ✓
53
+ - `"like Figma"` → `["figma"]` ✓
54
+
55
+ Per memory `feedback_panel_label_reliability.md`. Companion fix in `@adia-ai/a2ui-compose` Unreleased (generator.js panel emissions). Both surfaces feed the same reasoning-panel deception class — five distinct bugs caught + fixed in commit `9986c71e`.
56
+
57
+ ---
58
+
12
59
  ## [0.2.1] - 2026-05-02
13
60
 
14
61
  **Lockstep cut.** All 8 published `@adia-ai/*` packages bump 0.2.0 → 0.2.1 per [`docs/specs/package-architecture.md` § 15](../../../docs/specs/package-architecture.md#15-versioning-policy). Patch cut — no breaking changes.
@@ -13,8 +13,25 @@
13
13
 
14
14
  // ── Reference detection ──────────────────────────────────────────────────
15
15
 
16
- /** Patterns that indicate the user is referencing a specific product/design */
17
- const REFERENCE_PATTERNS = [
16
+ /**
17
+ * Patterns split by signal strength:
18
+ *
19
+ * EXPLICIT_PATTERNS — the surrounding language declares the captured
20
+ * token IS a brand reference ("like X", "X-style", "similar to X").
21
+ * The capture is accepted as a reference even if not in KNOWN_REFERENCES.
22
+ *
23
+ * IMPLICIT_PATTERNS — the surrounding language is a UI-shape verb
24
+ * ("X pricing page"); the capture COULD be a brand or COULD be a
25
+ * generic noun. Accept ONLY if in KNOWN_REFERENCES, otherwise drop.
26
+ *
27
+ * Splitting this way fixes the 2026-05-02 bug where "tier pricing page"
28
+ * extracted "tier" as a reference and seeded a research query for it. The
29
+ * regex was working as designed — `\w+ pricing page` captures the prefix
30
+ * word — but a generic noun like "tier" or "subscription" or "fancy"
31
+ * isn't a brand reference, so research and downstream prompt enrichment
32
+ * shouldn't act on it.
33
+ */
34
+ const EXPLICIT_PATTERNS = [
18
35
  /\blike\s+(\w[\w\s]*?)(?:\s*['']s|\s+style|\s+design|\s*$)/i,
19
36
  /\b(\w[\w\s]*?)[\s-]style\b/i,
20
37
  /\b(\w[\w\s]*?)[\s-]inspired\b/i,
@@ -22,6 +39,9 @@ const REFERENCE_PATTERNS = [
22
39
  /\bbased\s+on\s+(\w[\w\s]*?)(?:\s|$|,)/i,
23
40
  /\bcopy\s+(\w[\w\s]*?)(?:\s|$|,)/i,
24
41
  /\bclone\s+(\w[\w\s]*?)(?:\s|$|,)/i,
42
+ ];
43
+
44
+ const IMPLICIT_PATTERNS = [
25
45
  /\b(\w+)\s+(?:pricing|dashboard|landing|login|settings|profile)\s+page\b/i,
26
46
  ];
27
47
 
@@ -44,12 +64,11 @@ export function detectReferences(intent) {
44
64
  const references = [];
45
65
  const lower = intent.toLowerCase();
46
66
 
47
- // Pattern matching
48
- for (const pattern of REFERENCE_PATTERNS) {
67
+ // Explicit-signal patterns — accept the capture as a reference.
68
+ for (const pattern of EXPLICIT_PATTERNS) {
49
69
  const match = intent.match(pattern);
50
70
  if (match) {
51
71
  let ref = (match[1] || '').trim();
52
- // Strip leading articles
53
72
  ref = ref.replace(/^(the|a|an)\s+/i, '');
54
73
  if (ref && ref.length > 1 && ref.length < 30) {
55
74
  references.push(ref);
@@ -57,6 +76,19 @@ export function detectReferences(intent) {
57
76
  }
58
77
  }
59
78
 
79
+ // Implicit-signal patterns — gate by KNOWN_REFERENCES so generic nouns
80
+ // ("tier", "fancy", "simple") don't get treated as brands.
81
+ for (const pattern of IMPLICIT_PATTERNS) {
82
+ const match = intent.match(pattern);
83
+ if (match) {
84
+ let ref = (match[1] || '').trim();
85
+ ref = ref.replace(/^(the|a|an)\s+/i, '');
86
+ if (ref && ref.length > 1 && ref.length < 30 && KNOWN_REFERENCES.has(ref.toLowerCase())) {
87
+ references.push(ref);
88
+ }
89
+ }
90
+ }
91
+
60
92
  // Direct brand name detection (only as whole words)
61
93
  for (const brand of KNOWN_REFERENCES) {
62
94
  const re = new RegExp(`\\b${brand}\\b`, 'i');
@@ -65,7 +97,9 @@ export function detectReferences(intent) {
65
97
  }
66
98
  }
67
99
 
68
- // Filter out non-brand captures (e.g., "inspired" from "X-inspired")
100
+ // Filter out non-brand captures from the explicit patterns — words like
101
+ // "inspired" can sneak through when the intent is "X-inspired" with no
102
+ // X (e.g. "is this AI-inspired?"). Belt and suspenders.
69
103
  const NON_BRANDS = new Set(['inspired', 'style', 'based', 'like', 'similar', 'the']);
70
104
  for (let i = references.length - 1; i >= 0; i--) {
71
105
  if (NON_BRANDS.has(references[i].toLowerCase())) references.splice(i, 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adia-ai/a2ui-retrieval",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "AdiaUI A2UI retrieval layer — catalog lookup, intent classification, domain routing, pattern + anti-pattern matching, clarity + context assembly. Consumed by the compose engine and any A2UI-protocol tooling that needs to reason about user intent against the catalog.",
5
5
  "type": "module",
6
6
  "main": "./index.js",