@adia-ai/a2ui-retrieval 0.6.2 → 0.6.6
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 +38 -0
- package/domain-router.js +362 -117
- package/embedding/chunk-embedding-retriever.js +47 -79
- package/embedding/chunk-embedding-retriever.ts +2 -2
- package/embedding/embedding-provider.js +35 -71
- package/embedding/index.js +2 -10
- package/feedback/dialog-recorder.js +61 -145
- package/feedback/dialog-recorder.ts +11 -8
- package/feedback/feedback-analyzer.js +46 -102
- package/feedback/feedback-analyzer.ts +2 -2
- package/feedback/feedback-store.js +91 -107
- package/feedback/feedback-store.ts +1 -1
- package/feedback/feedback.js +36 -117
- package/feedback/gap-registry.js +40 -82
- package/feedback/index.js +14 -12
- package/index.js +53 -16
- package/intent/clarity.js +61 -129
- package/intent/decomposer.js +51 -143
- package/intent/decomposer.ts +1 -1
- package/intent/index.js +18 -14
- package/intent/intent-alignment.js +79 -150
- package/intent/intent-alignment.ts +5 -5
- package/intent/intent-categorizer.js +34 -62
- package/intent/intent-gate.js +43 -102
- package/intent/prompt-analyzer.js +68 -126
- package/intent/prompt-analyzer.ts +1 -1
- package/package.json +1 -1
- package/wiring-catalog.js +95 -146
package/wiring-catalog.js
CHANGED
|
@@ -1,195 +1,144 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wiring Catalog — Knowledge base for the gen-ui pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Indexes available wiring capabilities so the generator can emit valid
|
|
5
|
-
* wireComponents declarations alongside component trees.
|
|
6
|
-
*
|
|
7
|
-
* The schema has 5 docking points:
|
|
8
|
-
* DATA — sources, params (how the surface gets its data)
|
|
9
|
-
* STATE — controllers, model (how components manage behavior)
|
|
10
|
-
* ACTIONS — UIEvent → handler chains (what happens on events)
|
|
11
|
-
* PROVIDES — context injection into subtrees
|
|
12
|
-
* LIFECYCLE — onMount, onUnmount, onModelChange hooks
|
|
13
|
-
*
|
|
14
|
-
* Each point is optional. A static display surface needs none.
|
|
15
|
-
* A form needs STATE (FormController) + ACTIONS (submit).
|
|
16
|
-
* A dashboard needs DATA (sources) + STATE (DataStreamController).
|
|
17
|
-
* A full app needs all five.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
// ── UIEvent ──────────────────────────────────────────────────
|
|
21
|
-
// A typed event object that the wiring system understands natively.
|
|
22
|
-
// Maps 1:1 to DOM events but with AdiaUI semantics and payload contracts.
|
|
23
|
-
//
|
|
24
|
-
// { "event": "press", "target": "save-btn" }
|
|
25
|
-
// { "event": "input", "target": "search", "debounce": 300 }
|
|
26
|
-
// { "event": "submit", "target": "form-col" }
|
|
27
|
-
// { "event": "mount" }
|
|
28
|
-
//
|
|
29
|
-
// "event" — UIEvent type name (see adiaEvents below)
|
|
30
|
-
// "target" — component id that emits. Omit for surface-level events.
|
|
31
|
-
// "debounce" — ms, coalesce rapid-fire (input, resize)
|
|
32
|
-
// "throttle" — ms, limit frequency (scroll, drag)
|
|
33
|
-
// "condition" — guard: { path, equals|notEquals|exists }
|
|
34
|
-
|
|
35
1
|
const adiaEvents = [
|
|
36
|
-
{ event:
|
|
37
|
-
{ event:
|
|
38
|
-
{ event:
|
|
39
|
-
{ event:
|
|
40
|
-
{ event:
|
|
41
|
-
{ event:
|
|
42
|
-
{ event:
|
|
43
|
-
{ event:
|
|
44
|
-
{ event:
|
|
45
|
-
{ event:
|
|
46
|
-
{ event:
|
|
47
|
-
{ event:
|
|
48
|
-
{ event:
|
|
49
|
-
{ event:
|
|
2
|
+
{ event: "press", payload: null, description: "Button or interactive element activated." },
|
|
3
|
+
{ event: "submit", payload: "form-values", description: "Form submission with validated field values." },
|
|
4
|
+
{ event: "input", payload: "target-value", description: "Value changed (fires on every keystroke)." },
|
|
5
|
+
{ event: "change", payload: "event-detail", description: "Value committed (fires on blur or selection)." },
|
|
6
|
+
{ event: "select", payload: "event-detail", description: "Item selected from list, table, or menu." },
|
|
7
|
+
{ event: "toggle", payload: "boolean", description: "Boolean state flipped (switch, checkbox)." },
|
|
8
|
+
{ event: "dismiss", payload: null, description: "Close/dismiss (dialog, toast, popover)." },
|
|
9
|
+
{ event: "navigate", payload: "route", description: "Internal navigation request." },
|
|
10
|
+
{ event: "mount", payload: null, description: "Surface or component entered the DOM." },
|
|
11
|
+
{ event: "unmount", payload: null, description: "Surface or component left the DOM." },
|
|
12
|
+
{ event: "focus", payload: null, description: "Element received focus." },
|
|
13
|
+
{ event: "blur", payload: null, description: "Element lost focus." },
|
|
14
|
+
{ event: "drag", payload: "event-detail", description: "Drag operation on a sortable/draggable." },
|
|
15
|
+
{ event: "drop", payload: "event-detail", description: "Drop completed on a sortable/draggable." }
|
|
50
16
|
];
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Get the full wiring catalog.
|
|
54
|
-
* @returns {object}
|
|
55
|
-
*/
|
|
56
|
-
export function getWiringCatalog() {
|
|
17
|
+
function getWiringCatalog() {
|
|
57
18
|
return {
|
|
58
19
|
// ── ADIA EVENTS ──
|
|
59
20
|
adiaEvents,
|
|
60
|
-
|
|
61
21
|
// ── DATA: how the surface gets its data ──
|
|
62
22
|
data: {
|
|
63
|
-
description:
|
|
64
|
-
paramSources: [
|
|
65
|
-
uriSchemes: [
|
|
66
|
-
refreshStrategies: [
|
|
23
|
+
description: "Fetch external data into the surface model. Sources are URI-based with refresh strategies.",
|
|
24
|
+
paramSources: ["route", "store", "literal", "query", "parent"],
|
|
25
|
+
uriSchemes: ["resource://", "api://", "mock://", "ws://", "sse://"],
|
|
26
|
+
refreshStrategies: ["once", "on-focus", "interval:{ms}", "stream"],
|
|
67
27
|
example: {
|
|
68
|
-
params: { userId: { from:
|
|
28
|
+
params: { userId: { from: "route", key: "id" } },
|
|
69
29
|
sources: [
|
|
70
|
-
{ id:
|
|
71
|
-
{ id:
|
|
72
|
-
]
|
|
73
|
-
}
|
|
30
|
+
{ id: "user", uri: "resource://users/{userId}", path: "/user", refresh: "once" },
|
|
31
|
+
{ id: "activity", uri: "resource://users/{userId}/activity", path: "/activity", refresh: "on-focus" }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
74
34
|
},
|
|
75
|
-
|
|
76
35
|
// ── STATE: controllers that manage component behavior ──
|
|
77
36
|
controllers: [
|
|
78
37
|
{
|
|
79
|
-
type:
|
|
80
|
-
description:
|
|
38
|
+
type: "FormController",
|
|
39
|
+
description: "Manages field values, validation, dirty/pristine tracking. Attach to a Column/Section containing form fields.",
|
|
81
40
|
config: {
|
|
82
|
-
validateOn: { type:
|
|
41
|
+
validateOn: { type: "string", enum: ["blur", "change", "submit"], default: "blur" }
|
|
83
42
|
},
|
|
84
|
-
commands: [
|
|
85
|
-
bind: { values:
|
|
43
|
+
commands: ["validate", "reset", "setFieldError"],
|
|
44
|
+
bind: { values: "/form/values", valid: "/form/valid", dirty: "/form/dirty" }
|
|
86
45
|
},
|
|
87
46
|
{
|
|
88
|
-
type:
|
|
89
|
-
description:
|
|
47
|
+
type: "DataStreamController",
|
|
48
|
+
description: "Live data buffer for charts, tables, feeds. Supports push, SSE, WebSocket, polling.",
|
|
90
49
|
config: {
|
|
91
|
-
max: { type:
|
|
92
|
-
throttle: { type:
|
|
50
|
+
max: { type: "number", default: 100, description: "FIFO buffer size" },
|
|
51
|
+
throttle: { type: "number", default: 0, description: "Min ms between renders" }
|
|
93
52
|
},
|
|
94
|
-
commands: [
|
|
95
|
-
bind: { data:
|
|
53
|
+
commands: ["push", "pushMany", "connect", "poll", "consume", "stop", "clear"],
|
|
54
|
+
bind: { data: "/stream/data", status: "/stream/status" }
|
|
96
55
|
},
|
|
97
56
|
{
|
|
98
|
-
type:
|
|
99
|
-
description:
|
|
100
|
-
config: { mode: { type:
|
|
101
|
-
commands: [
|
|
102
|
-
bind: { selected:
|
|
57
|
+
type: "SelectionController",
|
|
58
|
+
description: "Single or multi-select state for lists, tables, grids.",
|
|
59
|
+
config: { mode: { type: "string", enum: ["single", "multi"], default: "single" } },
|
|
60
|
+
commands: ["select", "deselect", "toggle", "selectAll", "clear"],
|
|
61
|
+
bind: { selected: "/selection/items", count: "/selection/count" }
|
|
103
62
|
},
|
|
104
63
|
{
|
|
105
|
-
type:
|
|
106
|
-
description:
|
|
64
|
+
type: "ToggleController",
|
|
65
|
+
description: "Boolean on/off state with attribute reflection.",
|
|
107
66
|
config: {},
|
|
108
|
-
commands: [
|
|
109
|
-
bind: { value:
|
|
67
|
+
commands: ["toggle", "set"],
|
|
68
|
+
bind: { value: "/toggle/on" }
|
|
110
69
|
},
|
|
111
70
|
{
|
|
112
|
-
type:
|
|
113
|
-
description:
|
|
114
|
-
config: { multiple: { type:
|
|
115
|
-
commands: [
|
|
116
|
-
bind: { openPanels:
|
|
117
|
-
}
|
|
71
|
+
type: "AccordionController",
|
|
72
|
+
description: "Panel expand/collapse with mutual exclusion.",
|
|
73
|
+
config: { multiple: { type: "boolean", default: false } },
|
|
74
|
+
commands: ["open", "close", "toggle"],
|
|
75
|
+
bind: { openPanels: "/accordion/open" }
|
|
76
|
+
}
|
|
118
77
|
],
|
|
119
|
-
|
|
120
78
|
// ── ACTIONS: event → handler chains ──
|
|
121
79
|
handlers: [
|
|
122
|
-
{ name:
|
|
123
|
-
{ name:
|
|
124
|
-
{ name:
|
|
125
|
-
{ name:
|
|
126
|
-
{ name:
|
|
127
|
-
{ name:
|
|
128
|
-
{ name:
|
|
129
|
-
{ name:
|
|
80
|
+
{ name: "submit-resource", description: "POST/PUT/PATCH/DELETE to a resource URI.", config: ["uri", "method", "body"] },
|
|
81
|
+
{ name: "update-model", description: "Update the surface data model at a path.", config: ["path", "value"] },
|
|
82
|
+
{ name: "navigate", description: "Route to a path (supports {param} templates).", config: ["navigate"] },
|
|
83
|
+
{ name: "navigate-back", description: "Go back in browser history.", config: [] },
|
|
84
|
+
{ name: "controller-command", description: "Invoke a command on a controller.", config: ["controllerId", "command", "args"] },
|
|
85
|
+
{ name: "emit-event", description: "Dispatch a named CustomEvent on the surface.", config: ["eventName", "detail"] },
|
|
86
|
+
{ name: "refresh-source", description: "Re-fetch a named data source.", config: ["sourceId"] },
|
|
87
|
+
{ name: "notify", description: "Show a toast/alert notification.", config: ["message", "variant"] }
|
|
130
88
|
],
|
|
131
|
-
|
|
132
89
|
// ── ACTION SHAPE (UIEvent → handler) ──
|
|
133
90
|
actionShape: {
|
|
134
|
-
event:
|
|
135
|
-
handler:
|
|
136
|
-
config:
|
|
137
|
-
onSuccess:
|
|
138
|
-
onError:
|
|
91
|
+
event: "UIEvent object: { event, target?, debounce?, throttle?, condition? }",
|
|
92
|
+
handler: "Handler name from the handlers list.",
|
|
93
|
+
config: "Handler-specific configuration object.",
|
|
94
|
+
onSuccess: "Follow-up actions array (each is { handler, config }).",
|
|
95
|
+
onError: "Follow-up actions array on failure."
|
|
139
96
|
},
|
|
140
|
-
|
|
141
97
|
// ── PROVIDES: context injection ──
|
|
142
98
|
provides: {
|
|
143
|
-
description:
|
|
144
|
-
example: { name:
|
|
99
|
+
description: "Inject shared state into a component subtree via a2ui-provider. Children consume via context name.",
|
|
100
|
+
example: { name: "auth", host: "root", value: { user: null, token: null } }
|
|
145
101
|
},
|
|
146
|
-
|
|
147
102
|
// ── LIFECYCLE hooks ──
|
|
148
103
|
lifecycle: {
|
|
149
|
-
onMount:
|
|
150
|
-
onUnmount:
|
|
151
|
-
onModelChange:
|
|
104
|
+
onMount: "Actions to run when the surface first renders (fetch initial data, start streams).",
|
|
105
|
+
onUnmount: "Cleanup actions when the surface is destroyed (close WebSocket, stop polling).",
|
|
106
|
+
onModelChange: "Watch a model path and fire actions when it changes (debounce supported)."
|
|
152
107
|
},
|
|
153
|
-
|
|
154
108
|
// ── VALUE EXTRACTION (how actions read data) ──
|
|
155
109
|
valueSources: [
|
|
156
|
-
{ from:
|
|
157
|
-
{ from:
|
|
158
|
-
{ from:
|
|
159
|
-
{ from:
|
|
160
|
-
{ from:
|
|
161
|
-
{ from:
|
|
110
|
+
{ from: "event-detail", description: "Read from event.detail (key = property)" },
|
|
111
|
+
{ from: "event-target", description: "Read from event.target (key = property, e.g., value)" },
|
|
112
|
+
{ from: "model", description: "Read from data model (path = JSON Pointer)" },
|
|
113
|
+
{ from: "literal", description: "Static value (value = the value)" },
|
|
114
|
+
{ from: "param", description: "Read from resolved parameters (key = param name)" },
|
|
115
|
+
{ from: "controller", description: "Read from a controller state (controllerId + key)" }
|
|
162
116
|
],
|
|
163
|
-
|
|
164
117
|
// ── MULTI-SURFACE ASSOCIATIONS ──
|
|
165
118
|
associations: [
|
|
166
|
-
{ name:
|
|
167
|
-
{ name:
|
|
168
|
-
{ name:
|
|
169
|
-
{ name:
|
|
170
|
-
{ name:
|
|
171
|
-
{ name:
|
|
172
|
-
]
|
|
119
|
+
{ name: "routes-to", description: "Navigation \u2014 source links to target." },
|
|
120
|
+
{ name: "feeds", description: "Data flow \u2014 source output \u2192 target input." },
|
|
121
|
+
{ name: "shares-context", description: "Shared state \u2014 both read/write same context." },
|
|
122
|
+
{ name: "depends-on", description: "Lifecycle \u2014 source waits for target." },
|
|
123
|
+
{ name: "triggers", description: "Side effect \u2014 source event \u2192 target update." },
|
|
124
|
+
{ name: "contains", description: "Composition \u2014 target renders inside source." }
|
|
125
|
+
]
|
|
173
126
|
};
|
|
174
127
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
* Get UIEvent type info.
|
|
178
|
-
*/
|
|
179
|
-
export function getAdiaEvent(type) {
|
|
180
|
-
return adiaEvents.find(e => e.event === type) || null;
|
|
128
|
+
function getAdiaEvent(type) {
|
|
129
|
+
return adiaEvents.find((e) => e.event === type) ?? void 0;
|
|
181
130
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*/
|
|
186
|
-
export function getControllerInfo(type) {
|
|
187
|
-
return getWiringCatalog().controllers.find(c => c.type === type) || null;
|
|
131
|
+
function getControllerInfo(type) {
|
|
132
|
+
const catalog = getWiringCatalog();
|
|
133
|
+
return catalog["controllers"].find((c) => c.type === type) ?? void 0;
|
|
188
134
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
*/
|
|
193
|
-
export function getHandlerInfo(name) {
|
|
194
|
-
return getWiringCatalog().handlers.find(h => h.name === name) || null;
|
|
135
|
+
function getHandlerInfo(name) {
|
|
136
|
+
const catalog = getWiringCatalog();
|
|
137
|
+
return catalog["handlers"].find((h) => h.name === name) ?? void 0;
|
|
195
138
|
}
|
|
139
|
+
export {
|
|
140
|
+
getAdiaEvent,
|
|
141
|
+
getControllerInfo,
|
|
142
|
+
getHandlerInfo,
|
|
143
|
+
getWiringCatalog
|
|
144
|
+
};
|