@adia-ai/a2ui-retrieval 0.6.4 → 0.6.7
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 +25 -0
- package/domain-router.js +362 -117
- package/embedding/chunk-embedding-retriever.js +47 -79
- package/embedding/embedding-provider.js +35 -71
- package/embedding/index.js +2 -10
- package/feedback/dialog-recorder.js +61 -145
- package/feedback/feedback-analyzer.js +46 -102
- package/feedback/feedback-store.js +91 -107
- package/feedback/feedback.js +36 -117
- package/feedback/gap-registry.js +40 -82
- package/feedback/index.js +14 -12
- package/index.d.ts +4 -0
- package/index.js +53 -16
- package/intent/clarity.js +61 -129
- package/intent/decomposer.js +51 -143
- package/intent/index.js +18 -14
- package/intent/intent-alignment.js +79 -150
- package/intent/intent-categorizer.js +34 -62
- package/intent/intent-gate.js +43 -102
- package/intent/prompt-analyzer.js +68 -126
- package/package.json +4 -2
- package/wiring-catalog.js +95 -146
- package/embedding/chunk-embedding-retriever.ts +0 -156
- package/embedding/embedding-provider.ts +0 -111
- package/embedding/index.ts +0 -10
- package/feedback/dialog-recorder.ts +0 -172
- package/feedback/feedback-analyzer.ts +0 -250
- package/feedback/feedback-store.ts +0 -229
- package/feedback/feedback.ts +0 -201
- package/feedback/gap-registry.ts +0 -137
- package/feedback/index.ts +0 -14
- package/intent/clarity.ts +0 -224
- package/intent/decomposer.ts +0 -229
- package/intent/index.ts +0 -20
- package/intent/intent-alignment.ts +0 -267
- package/intent/intent-categorizer.ts +0 -104
- package/intent/intent-gate.ts +0 -151
- package/intent/prompt-analyzer.ts +0 -231
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog — @adia-ai/a2ui-retrieval
|
|
2
2
|
|
|
3
|
+
## [0.6.7] — 2026-05-19
|
|
4
|
+
|
|
5
|
+
- Lockstep version bump; no source changes.
|
|
6
|
+
|
|
7
|
+
## [0.6.6] — 2026-05-18
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- Lockstep version bump for §304 `<field-ui align>` prop.
|
|
11
|
+
## [0.6.5] — 2026-05-18
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- `wiring-catalog.ts`: replaced `export declare function` stubs with real
|
|
15
|
+
typed implementations — `getControllerInfo` and `getHandlerInfo` were no-ops
|
|
16
|
+
after Phase 4 conversion (body was in the deleted .js file).
|
|
17
|
+
- `node-shims.d.ts` (shared): ambient `declare module` stubs for `node:*`
|
|
18
|
+
built-ins so `tsconfig.base.json` `"types":[]` doesn't block retrieval.
|
|
19
|
+
- `embedding/chunk-embedding-retriever.ts`: exactOptionalPropertyTypes
|
|
20
|
+
conditional spread for `{ model }` arg.
|
|
21
|
+
- `feedback/dialog-recorder.ts`, `feedback-analyzer.ts`, `feedback-store.ts`,
|
|
22
|
+
`feedback/gap-registry.ts`, `intent/decomposer.ts`, `intent/intent-alignment.ts`,
|
|
23
|
+
`intent/prompt-analyzer.ts`: noUncheckedIndexedAccess guards, implicit-any
|
|
24
|
+
filter params, null-coalesce fallbacks on regex match groups.
|
|
25
|
+
- All .ts files re-emitted to .js via esbuild (18ms per package) — runtime
|
|
26
|
+
module resolution was broken after Phase 4 deleted the original .js sources.
|
|
27
|
+
- `tsconfig.json`: include `../node-shims.d.ts`.
|
|
3
28
|
Follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
4
29
|
[Semantic Versioning](https://semver.org/).
|
|
5
30
|
## [Unreleased]
|
package/domain-router.js
CHANGED
|
@@ -1,125 +1,385 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain Router — Intent-to-domain classification via keyword matching.
|
|
3
|
-
*
|
|
4
|
-
* Five domains: forms, data, layout, agent, navigation.
|
|
5
|
-
* Each has signal keywords weighted for matching confidence.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
1
|
const domains = {
|
|
9
2
|
forms: {
|
|
10
3
|
keywords: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
"login",
|
|
5
|
+
"signup",
|
|
6
|
+
"sign up",
|
|
7
|
+
"register",
|
|
8
|
+
"input",
|
|
9
|
+
"field",
|
|
10
|
+
"form",
|
|
11
|
+
"validation",
|
|
12
|
+
"submit",
|
|
13
|
+
"password",
|
|
14
|
+
"email",
|
|
15
|
+
"checkbox",
|
|
16
|
+
"toggle",
|
|
17
|
+
"radio",
|
|
18
|
+
"select",
|
|
19
|
+
"dropdown",
|
|
20
|
+
"upload",
|
|
21
|
+
"otp",
|
|
22
|
+
"text field",
|
|
23
|
+
"date picker",
|
|
24
|
+
"slider",
|
|
25
|
+
"textarea",
|
|
26
|
+
"required",
|
|
27
|
+
"label",
|
|
28
|
+
"settings",
|
|
29
|
+
"configure",
|
|
30
|
+
"preference",
|
|
31
|
+
"margin",
|
|
32
|
+
"bleed",
|
|
33
|
+
"preview",
|
|
34
|
+
"approve",
|
|
35
|
+
"approval",
|
|
36
|
+
"photo",
|
|
37
|
+
"design system",
|
|
38
|
+
"button",
|
|
39
|
+
"cancel",
|
|
40
|
+
"action",
|
|
41
|
+
"reset",
|
|
42
|
+
"color picker",
|
|
43
|
+
"theme",
|
|
44
|
+
"swatch",
|
|
45
|
+
"two factor",
|
|
46
|
+
"authentication",
|
|
47
|
+
"verification",
|
|
48
|
+
"verify",
|
|
49
|
+
"subscribe",
|
|
50
|
+
"newsletter",
|
|
51
|
+
"survey",
|
|
52
|
+
"rbac",
|
|
53
|
+
"role",
|
|
54
|
+
"roles",
|
|
55
|
+
"permission",
|
|
56
|
+
"permissions",
|
|
57
|
+
"mfa",
|
|
58
|
+
"two-factor",
|
|
59
|
+
"session",
|
|
60
|
+
"sessions",
|
|
61
|
+
"device",
|
|
62
|
+
"devices",
|
|
63
|
+
"revoke",
|
|
64
|
+
"signing",
|
|
65
|
+
"destructive",
|
|
66
|
+
"confirm",
|
|
67
|
+
"confirmation",
|
|
68
|
+
"type to",
|
|
69
|
+
"type-to",
|
|
70
|
+
"mapping",
|
|
71
|
+
"mapper",
|
|
72
|
+
"csv",
|
|
73
|
+
"import"
|
|
24
74
|
],
|
|
25
75
|
components: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
76
|
+
"Input",
|
|
77
|
+
"CheckBox",
|
|
78
|
+
"Toggle",
|
|
79
|
+
"Switch",
|
|
80
|
+
"Slider",
|
|
81
|
+
"Select",
|
|
82
|
+
"Radio",
|
|
83
|
+
"TextArea",
|
|
84
|
+
"Upload",
|
|
85
|
+
"OtpInput",
|
|
86
|
+
"CalendarPicker",
|
|
87
|
+
"ColorPicker",
|
|
88
|
+
"Range",
|
|
89
|
+
"Button"
|
|
90
|
+
]
|
|
30
91
|
},
|
|
31
92
|
data: {
|
|
32
93
|
keywords: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
94
|
+
"table",
|
|
95
|
+
"chart",
|
|
96
|
+
"stat",
|
|
97
|
+
"metric",
|
|
98
|
+
"dashboard",
|
|
99
|
+
"graph",
|
|
100
|
+
"report",
|
|
101
|
+
"analytics",
|
|
102
|
+
"data",
|
|
103
|
+
"list",
|
|
104
|
+
"grid",
|
|
105
|
+
"sort",
|
|
106
|
+
"filter",
|
|
107
|
+
"paginate",
|
|
108
|
+
"pagination",
|
|
109
|
+
"row",
|
|
110
|
+
"column",
|
|
111
|
+
"progress",
|
|
112
|
+
"sparkline",
|
|
113
|
+
"kpi",
|
|
114
|
+
"kanban",
|
|
115
|
+
"board",
|
|
116
|
+
"activity",
|
|
117
|
+
"feed",
|
|
118
|
+
"timeline",
|
|
119
|
+
"leaderboard",
|
|
120
|
+
"inventory",
|
|
121
|
+
"project",
|
|
122
|
+
"task",
|
|
123
|
+
"tasks",
|
|
124
|
+
"team",
|
|
125
|
+
"calendar",
|
|
126
|
+
"tracker",
|
|
127
|
+
"tracking",
|
|
128
|
+
"monitor",
|
|
129
|
+
"monitoring",
|
|
130
|
+
"weather",
|
|
131
|
+
"pricing",
|
|
132
|
+
"product",
|
|
133
|
+
"bookmark",
|
|
134
|
+
"music",
|
|
135
|
+
"player",
|
|
136
|
+
"shopping",
|
|
137
|
+
"cart",
|
|
138
|
+
"order",
|
|
139
|
+
"invoice",
|
|
140
|
+
"receipt",
|
|
141
|
+
"checkout",
|
|
142
|
+
"inbox",
|
|
143
|
+
"notification",
|
|
144
|
+
"changelog",
|
|
145
|
+
"permission",
|
|
146
|
+
"cohort",
|
|
147
|
+
"retention",
|
|
148
|
+
"heatmap",
|
|
149
|
+
"funnel",
|
|
150
|
+
"conversion",
|
|
151
|
+
"audit",
|
|
152
|
+
"log",
|
|
153
|
+
"logs",
|
|
154
|
+
"viewer",
|
|
155
|
+
"audit log",
|
|
156
|
+
"integration",
|
|
157
|
+
"integrations",
|
|
158
|
+
"marketplace",
|
|
159
|
+
"webhook",
|
|
160
|
+
"webhooks",
|
|
161
|
+
"endpoint",
|
|
162
|
+
"delivery",
|
|
163
|
+
"usage",
|
|
164
|
+
"quota",
|
|
165
|
+
"meter",
|
|
166
|
+
"limit",
|
|
167
|
+
"limits",
|
|
168
|
+
"incident",
|
|
169
|
+
"status page",
|
|
170
|
+
"uptime",
|
|
171
|
+
"release",
|
|
172
|
+
"releases",
|
|
173
|
+
"release notes",
|
|
174
|
+
"flag",
|
|
175
|
+
"flags",
|
|
176
|
+
"feature flag",
|
|
177
|
+
"rollout",
|
|
178
|
+
"api key",
|
|
179
|
+
"api keys",
|
|
180
|
+
"token",
|
|
181
|
+
"tokens",
|
|
182
|
+
"object inspector",
|
|
183
|
+
"inspector",
|
|
184
|
+
"record",
|
|
185
|
+
"virtualized",
|
|
186
|
+
"virtual scroll",
|
|
187
|
+
"sticky",
|
|
188
|
+
"column manager",
|
|
189
|
+
"reorder",
|
|
190
|
+
"saved view",
|
|
191
|
+
"saved views",
|
|
192
|
+
"view",
|
|
193
|
+
"bulk",
|
|
194
|
+
"bulk action",
|
|
195
|
+
"selection"
|
|
56
196
|
],
|
|
57
197
|
components: [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
198
|
+
"Table",
|
|
199
|
+
"Chart",
|
|
200
|
+
"Stat",
|
|
201
|
+
"Progress",
|
|
202
|
+
"Timeline",
|
|
203
|
+
"List",
|
|
204
|
+
"Grid",
|
|
205
|
+
"Badge",
|
|
206
|
+
"Pagination",
|
|
207
|
+
"Avatar",
|
|
208
|
+
"Skeleton"
|
|
209
|
+
]
|
|
61
210
|
},
|
|
62
211
|
layout: {
|
|
63
212
|
keywords: [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
213
|
+
"page",
|
|
214
|
+
"grid",
|
|
215
|
+
"sidebar",
|
|
216
|
+
"header",
|
|
217
|
+
"footer",
|
|
218
|
+
"hero",
|
|
219
|
+
"section",
|
|
220
|
+
"column",
|
|
221
|
+
"row",
|
|
222
|
+
"card",
|
|
223
|
+
"panel",
|
|
224
|
+
"divider",
|
|
225
|
+
"stack",
|
|
226
|
+
"block",
|
|
227
|
+
"container",
|
|
228
|
+
"layout",
|
|
229
|
+
"spacing",
|
|
230
|
+
"gap",
|
|
231
|
+
"toolbar",
|
|
232
|
+
"image",
|
|
233
|
+
"embed",
|
|
234
|
+
"gallery",
|
|
235
|
+
"profile",
|
|
236
|
+
"testimonial",
|
|
237
|
+
"feature",
|
|
238
|
+
"cta",
|
|
239
|
+
"landing",
|
|
240
|
+
"swiper",
|
|
241
|
+
"carousel",
|
|
242
|
+
"slideshow",
|
|
243
|
+
"slides",
|
|
244
|
+
"slider",
|
|
245
|
+
"wizard",
|
|
246
|
+
"steps",
|
|
247
|
+
"stepper",
|
|
248
|
+
"accordion",
|
|
249
|
+
"faq",
|
|
250
|
+
"toast",
|
|
251
|
+
"alert",
|
|
252
|
+
"banner",
|
|
253
|
+
"badge",
|
|
254
|
+
"tag",
|
|
255
|
+
"code",
|
|
256
|
+
"snippet",
|
|
257
|
+
"skeleton",
|
|
258
|
+
"loading",
|
|
259
|
+
"empty",
|
|
260
|
+
"error",
|
|
261
|
+
"onboarding",
|
|
262
|
+
"avatar",
|
|
263
|
+
"popover",
|
|
264
|
+
"tooltip",
|
|
265
|
+
"modal",
|
|
266
|
+
"dialog",
|
|
267
|
+
"drawer",
|
|
268
|
+
"breadcrumb",
|
|
269
|
+
"recipe",
|
|
270
|
+
"blog",
|
|
271
|
+
"post",
|
|
272
|
+
"comparison",
|
|
273
|
+
"three-pane",
|
|
274
|
+
"three pane",
|
|
275
|
+
"list-detail",
|
|
276
|
+
"master-detail",
|
|
277
|
+
"split pane",
|
|
278
|
+
"bento",
|
|
279
|
+
"workspace",
|
|
280
|
+
"switcher",
|
|
281
|
+
"org",
|
|
282
|
+
"shell",
|
|
283
|
+
"app shell"
|
|
77
284
|
],
|
|
78
285
|
components: [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
286
|
+
"Row",
|
|
287
|
+
"Column",
|
|
288
|
+
"Grid",
|
|
289
|
+
"Card",
|
|
290
|
+
"Divider",
|
|
291
|
+
"Tabs",
|
|
292
|
+
"Tab",
|
|
293
|
+
"Accordion",
|
|
294
|
+
"Toolbar",
|
|
295
|
+
"Drawer",
|
|
296
|
+
"Modal",
|
|
297
|
+
"Pane",
|
|
298
|
+
"Image",
|
|
299
|
+
"Embed",
|
|
300
|
+
"Tag",
|
|
301
|
+
"Kbd",
|
|
302
|
+
"Code",
|
|
303
|
+
"Swiper"
|
|
304
|
+
]
|
|
83
305
|
},
|
|
84
306
|
agent: {
|
|
85
307
|
keywords: [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
308
|
+
"chat",
|
|
309
|
+
"message",
|
|
310
|
+
"stream",
|
|
311
|
+
"ai",
|
|
312
|
+
"prompt",
|
|
313
|
+
"generate",
|
|
314
|
+
"conversation",
|
|
315
|
+
"assistant",
|
|
316
|
+
"bot",
|
|
317
|
+
"agent",
|
|
318
|
+
"llm",
|
|
319
|
+
"response",
|
|
320
|
+
"streaming",
|
|
321
|
+
"a2ui",
|
|
322
|
+
"surface",
|
|
323
|
+
"render",
|
|
324
|
+
"dynamic",
|
|
325
|
+
"empty",
|
|
326
|
+
"error",
|
|
327
|
+
"loading"
|
|
89
328
|
],
|
|
90
329
|
components: [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
330
|
+
"Stream",
|
|
331
|
+
"Card",
|
|
332
|
+
"Text",
|
|
333
|
+
"Button",
|
|
334
|
+
"Column",
|
|
335
|
+
"Row",
|
|
336
|
+
"Alert",
|
|
337
|
+
"Toast",
|
|
338
|
+
"EmptyState",
|
|
339
|
+
"Skeleton",
|
|
340
|
+
"Tooltip",
|
|
341
|
+
"Popover"
|
|
342
|
+
]
|
|
94
343
|
},
|
|
95
344
|
navigation: {
|
|
96
345
|
keywords: [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
346
|
+
"menu",
|
|
347
|
+
"nav",
|
|
348
|
+
"breadcrumb",
|
|
349
|
+
"tab",
|
|
350
|
+
"tabs",
|
|
351
|
+
"sidebar",
|
|
352
|
+
"link",
|
|
353
|
+
"route",
|
|
354
|
+
"router",
|
|
355
|
+
"navigate",
|
|
356
|
+
"page",
|
|
357
|
+
"sitemap",
|
|
358
|
+
"command palette",
|
|
359
|
+
"command",
|
|
360
|
+
"segmented",
|
|
361
|
+
"breadcrumbs"
|
|
100
362
|
],
|
|
101
363
|
components: [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
364
|
+
"Nav",
|
|
365
|
+
"Breadcrumb",
|
|
366
|
+
"Tabs",
|
|
367
|
+
"Tab",
|
|
368
|
+
"Menu",
|
|
369
|
+
"Command",
|
|
370
|
+
"SegmentedControl",
|
|
371
|
+
"Segment",
|
|
372
|
+
"Pagination"
|
|
373
|
+
]
|
|
374
|
+
}
|
|
106
375
|
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Classify an intent string into a domain.
|
|
110
|
-
*
|
|
111
|
-
* @param {string} text — Natural language intent
|
|
112
|
-
* @returns {{ domain: string, confidence: number, matchedSignals: string[], suggestedComponents: string[] }}
|
|
113
|
-
*/
|
|
114
|
-
export function classifyIntent(text) {
|
|
376
|
+
function classifyIntent(text) {
|
|
115
377
|
const lower = text.toLowerCase();
|
|
116
378
|
const scores = {};
|
|
117
379
|
const matches = {};
|
|
118
|
-
|
|
119
380
|
for (const [domain, config] of Object.entries(domains)) {
|
|
120
381
|
scores[domain] = 0;
|
|
121
382
|
matches[domain] = [];
|
|
122
|
-
|
|
123
383
|
for (const keyword of config.keywords) {
|
|
124
384
|
if (lower.includes(keyword)) {
|
|
125
385
|
scores[domain]++;
|
|
@@ -127,46 +387,31 @@ export function classifyIntent(text) {
|
|
|
127
387
|
}
|
|
128
388
|
}
|
|
129
389
|
}
|
|
130
|
-
|
|
131
|
-
// Find the top domain
|
|
132
|
-
let bestDomain = 'layout'; // default fallback
|
|
390
|
+
let bestDomain = "layout";
|
|
133
391
|
let bestScore = 0;
|
|
134
|
-
|
|
135
392
|
for (const [domain, score] of Object.entries(scores)) {
|
|
136
393
|
if (score > bestScore) {
|
|
137
394
|
bestScore = score;
|
|
138
395
|
bestDomain = domain;
|
|
139
396
|
}
|
|
140
397
|
}
|
|
141
|
-
|
|
142
|
-
// Confidence: ratio of matched keywords to total keywords in the domain
|
|
143
398
|
const totalKeywords = domains[bestDomain].keywords.length;
|
|
144
|
-
const confidence = bestScore > 0
|
|
145
|
-
? Math.min(1, bestScore / Math.max(3, totalKeywords * 0.3))
|
|
146
|
-
: 0;
|
|
147
|
-
|
|
399
|
+
const confidence = bestScore > 0 ? Math.min(1, bestScore / Math.max(3, totalKeywords * 0.3)) : 0;
|
|
148
400
|
return {
|
|
149
401
|
domain: bestDomain,
|
|
150
402
|
confidence: Math.round(confidence * 100) / 100,
|
|
151
|
-
matchedSignals: matches[bestDomain],
|
|
152
|
-
suggestedComponents: domains[bestDomain].components
|
|
403
|
+
matchedSignals: matches[bestDomain] ?? [],
|
|
404
|
+
suggestedComponents: domains[bestDomain].components
|
|
153
405
|
};
|
|
154
406
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* Get domain configuration (keywords + components) for a given domain.
|
|
158
|
-
*
|
|
159
|
-
* @param {string} domain — Domain name
|
|
160
|
-
* @returns {object|null}
|
|
161
|
-
*/
|
|
162
|
-
export function getDomain(domain) {
|
|
163
|
-
return domains[domain] || null;
|
|
407
|
+
function getDomain(domain) {
|
|
408
|
+
return domains[domain] ?? null;
|
|
164
409
|
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Get all domain names.
|
|
168
|
-
* @returns {string[]}
|
|
169
|
-
*/
|
|
170
|
-
export function getAllDomains() {
|
|
410
|
+
function getAllDomains() {
|
|
171
411
|
return Object.keys(domains);
|
|
172
412
|
}
|
|
413
|
+
export {
|
|
414
|
+
classifyIntent,
|
|
415
|
+
getAllDomains,
|
|
416
|
+
getDomain
|
|
417
|
+
};
|