@adia-ai/web-components 0.0.28 → 0.0.33
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/README.md +4 -8
- package/a2ui/index.js +1 -1
- package/components/accordion/accordion.a2ui.json +1 -1
- package/components/accordion/accordion.js +6 -6
- package/components/accordion/accordion.yaml +1 -1
- package/components/action-list/action-list.a2ui.json +1 -1
- package/components/action-list/action-list.js +6 -6
- package/components/action-list/action-list.yaml +1 -1
- package/components/agent-artifact/agent-artifact.a2ui.json +1 -1
- package/components/agent-artifact/agent-artifact.js +4 -4
- package/components/agent-artifact/agent-artifact.yaml +1 -1
- package/components/agent-feedback-bar/agent-feedback-bar.a2ui.json +1 -1
- package/components/agent-feedback-bar/agent-feedback-bar.js +4 -4
- package/components/agent-feedback-bar/agent-feedback-bar.yaml +1 -1
- package/components/agent-questions/agent-questions.a2ui.json +1 -1
- package/components/agent-questions/agent-questions.js +4 -4
- package/components/agent-questions/agent-questions.yaml +1 -1
- package/components/agent-reasoning/agent-reasoning.a2ui.json +3 -3
- package/components/agent-reasoning/agent-reasoning.js +4 -4
- package/components/agent-reasoning/agent-reasoning.yaml +3 -3
- package/components/agent-suggestions/agent-suggestions.a2ui.json +1 -1
- package/components/agent-suggestions/agent-suggestions.js +4 -4
- package/components/agent-suggestions/agent-suggestions.yaml +1 -1
- package/components/agent-trace/agent-trace.a2ui.json +1 -1
- package/components/agent-trace/agent-trace.js +4 -4
- package/components/agent-trace/agent-trace.yaml +1 -1
- package/components/alert/alert.a2ui.json +1 -1
- package/components/alert/alert.js +4 -4
- package/components/alert/alert.yaml +1 -1
- package/components/aside/aside.a2ui.json +1 -1
- package/components/aside/aside.yaml +1 -1
- package/components/avatar/avatar.a2ui.json +1 -1
- package/components/avatar/avatar.js +8 -8
- package/components/avatar/avatar.yaml +1 -1
- package/components/badge/badge.a2ui.json +1 -1
- package/components/badge/badge.js +4 -4
- package/components/badge/badge.yaml +1 -1
- package/components/block/block.a2ui.json +1 -1
- package/components/block/block.js +4 -4
- package/components/block/block.yaml +1 -1
- package/components/breadcrumb/breadcrumb.a2ui.json +1 -1
- package/components/breadcrumb/breadcrumb.js +4 -4
- package/components/breadcrumb/breadcrumb.yaml +1 -1
- package/components/button/button.a2ui.json +1 -1
- package/components/button/button.js +4 -4
- package/components/button/button.yaml +1 -1
- package/components/calendar-picker/calendar-picker.a2ui.json +1 -1
- package/components/calendar-picker/calendar-picker.js +6 -6
- package/components/calendar-picker/calendar-picker.yaml +1 -1
- package/components/canvas/canvas.a2ui.json +1 -1
- package/components/canvas/canvas.js +5 -5
- package/components/canvas/canvas.yaml +1 -1
- package/components/card/card.a2ui.json +1 -1
- package/components/card/card.js +4 -4
- package/components/card/card.yaml +1 -1
- package/components/chart/chart.a2ui.json +1 -1
- package/components/chart/chart.js +5 -5
- package/components/chart/chart.yaml +1 -1
- package/components/chart-legend/chart-legend.a2ui.json +1 -1
- package/components/chart-legend/chart-legend.js +7 -7
- package/components/chart-legend/chart-legend.yaml +1 -1
- package/components/{chat → chat-thread}/chat-input.js +5 -5
- package/components/{chat/chat.a2ui.json → chat-thread/chat-thread.a2ui.json} +6 -6
- package/components/{chat/chat.css → chat-thread/chat-thread.css} +2 -2
- package/components/{chat/chat.js → chat-thread/chat-thread.js} +7 -7
- package/components/{chat/chat.yaml → chat-thread/chat-thread.yaml} +4 -4
- package/components/check/check.a2ui.json +1 -1
- package/components/check/check.js +5 -5
- package/components/check/check.yaml +1 -1
- package/components/code/code.a2ui.json +1 -1
- package/components/code/code.js +4 -4
- package/components/code/code.yaml +1 -1
- package/components/col/col.a2ui.json +1 -1
- package/components/col/col.js +4 -4
- package/components/col/col.yaml +1 -1
- package/components/color-picker/color-picker.a2ui.json +1 -1
- package/components/color-picker/color-picker.js +6 -6
- package/components/color-picker/color-picker.yaml +1 -1
- package/components/command/command.a2ui.json +1 -1
- package/components/command/command.js +5 -5
- package/components/command/command.yaml +1 -1
- package/components/description-list/description-list.a2ui.json +1 -1
- package/components/description-list/description-list.js +4 -4
- package/components/description-list/description-list.yaml +1 -1
- package/components/divider/divider.a2ui.json +1 -1
- package/components/divider/divider.js +4 -4
- package/components/divider/divider.yaml +1 -1
- package/components/drawer/drawer.a2ui.json +1 -1
- package/components/drawer/drawer.js +4 -4
- package/components/drawer/drawer.yaml +1 -1
- package/components/embed/embed.a2ui.json +1 -1
- package/components/embed/embed.js +4 -4
- package/components/embed/embed.yaml +1 -1
- package/components/empty-state/empty-state.a2ui.json +1 -1
- package/components/empty-state/empty-state.js +4 -4
- package/components/empty-state/empty-state.yaml +1 -1
- package/components/feed/feed-item.yaml +2 -2
- package/components/feed/feed.a2ui.json +2 -2
- package/components/feed/feed.css +21 -3
- package/components/feed/feed.js +140 -31
- package/components/feed/feed.yaml +2 -2
- package/components/field/field.a2ui.json +1 -1
- package/components/field/field.js +10 -10
- package/components/field/field.yaml +2 -2
- package/components/footer/footer.a2ui.json +1 -1
- package/components/footer/footer.yaml +1 -1
- package/components/grid/grid.a2ui.json +1 -1
- package/components/grid/grid.js +4 -4
- package/components/grid/grid.yaml +1 -1
- package/components/header/header.a2ui.json +1 -1
- package/components/header/header.yaml +1 -1
- package/components/heatmap/heatmap.a2ui.json +1 -1
- package/components/heatmap/heatmap.js +4 -4
- package/components/heatmap/heatmap.yaml +1 -1
- package/components/icon/icon.a2ui.json +1 -1
- package/components/icon/icon.js +4 -4
- package/components/icon/icon.yaml +1 -1
- package/components/image/image.a2ui.json +1 -1
- package/components/image/image.js +4 -4
- package/components/image/image.yaml +1 -1
- package/components/index.js +88 -85
- package/components/input/input.a2ui.json +1 -1
- package/components/input/input.js +7 -7
- package/components/input/input.yaml +1 -1
- package/components/inspector/inspector.a2ui.json +1 -1
- package/components/inspector/inspector.js +4 -4
- package/components/inspector/inspector.yaml +1 -1
- package/components/kbd/kbd.a2ui.json +1 -1
- package/components/kbd/kbd.js +4 -4
- package/components/kbd/kbd.yaml +1 -1
- package/components/list/list.a2ui.json +1 -1
- package/components/list/list.js +6 -6
- package/components/list/list.yaml +1 -1
- package/components/menu/menu.a2ui.json +1 -1
- package/components/menu/menu.js +8 -8
- package/components/menu/menu.yaml +1 -1
- package/components/modal/modal.a2ui.json +1 -1
- package/components/modal/modal.js +4 -4
- package/components/modal/modal.yaml +1 -1
- package/components/nav/nav.a2ui.json +98 -0
- package/components/nav/nav.css +133 -0
- package/components/nav/nav.js +140 -0
- package/components/nav/nav.test.js +428 -0
- package/components/nav/nav.yaml +114 -0
- package/components/nav-group/nav-group.a2ui.json +100 -0
- package/{patterns/app-nav-group/app-nav-group.css → components/nav-group/nav-group.css} +71 -18
- package/{patterns/app-nav-group/app-nav-group.js → components/nav-group/nav-group.js} +51 -25
- package/components/nav-group/nav-group.yaml +69 -0
- package/components/nav-item/nav-item.a2ui.json +106 -0
- package/{patterns/app-nav-item/app-nav-item.css → components/nav-item/nav-item.css} +42 -10
- package/components/nav-item/nav-item.js +76 -0
- package/components/nav-item/nav-item.yaml +73 -0
- package/components/noodles/noodles.a2ui.json +1 -1
- package/components/noodles/noodles.js +4 -4
- package/components/noodles/noodles.yaml +1 -1
- package/components/option-card/option-card.a2ui.json +1 -1
- package/components/option-card/option-card.js +6 -6
- package/components/option-card/option-card.yaml +1 -1
- package/components/otp-input/otp-input.a2ui.json +1 -1
- package/components/otp-input/otp-input.js +5 -5
- package/components/otp-input/otp-input.yaml +1 -1
- package/components/page/page.a2ui.json +3 -3
- package/components/page/page.js +4 -4
- package/components/page/page.yaml +3 -3
- package/components/pagination/pagination.a2ui.json +1 -1
- package/components/pagination/pagination.js +4 -4
- package/components/pagination/pagination.yaml +1 -1
- package/components/pane/pane.a2ui.json +1 -1
- package/components/pane/pane.js +4 -4
- package/components/pane/pane.yaml +1 -1
- package/components/pipeline-status/pipeline-status.a2ui.json +1 -1
- package/components/pipeline-status/pipeline-status.js +4 -4
- package/components/pipeline-status/pipeline-status.yaml +1 -1
- package/components/popover/popover.a2ui.json +1 -1
- package/components/popover/popover.js +4 -4
- package/components/popover/popover.yaml +1 -1
- package/components/progress/progress.a2ui.json +1 -1
- package/components/progress/progress.js +4 -4
- package/components/progress/progress.yaml +1 -1
- package/components/progress-row/progress-row.a2ui.json +1 -1
- package/components/progress-row/progress-row.js +4 -4
- package/components/progress-row/progress-row.yaml +1 -1
- package/components/radio/radio.a2ui.json +1 -1
- package/components/radio/radio.js +5 -5
- package/components/radio/radio.yaml +1 -1
- package/components/range/range.a2ui.json +1 -1
- package/components/range/range.js +7 -7
- package/components/range/range.yaml +1 -1
- package/components/rating/rating.a2ui.json +1 -1
- package/components/rating/rating.js +6 -6
- package/components/rating/rating.yaml +1 -1
- package/components/richtext/richtext.a2ui.json +1 -1
- package/components/richtext/richtext.js +4 -4
- package/components/richtext/richtext.yaml +1 -1
- package/components/row/row.a2ui.json +1 -1
- package/components/row/row.js +4 -4
- package/components/row/row.yaml +1 -1
- package/components/search/search.a2ui.json +1 -1
- package/components/search/search.js +5 -5
- package/components/search/search.yaml +1 -1
- package/components/section/section.a2ui.json +1 -1
- package/components/section/section.yaml +1 -1
- package/components/segment/segment.a2ui.json +1 -1
- package/components/segment/segment.js +4 -4
- package/components/segment/segment.yaml +1 -1
- package/components/segmented/segmented.a2ui.json +1 -1
- package/components/segmented/segmented.css +6 -0
- package/components/segmented/segmented.js +7 -7
- package/components/segmented/segmented.yaml +1 -1
- package/components/select/select.a2ui.json +1 -1
- package/components/select/select.js +5 -5
- package/components/select/select.yaml +1 -1
- package/components/skeleton/skeleton.a2ui.json +1 -1
- package/components/skeleton/skeleton.js +4 -4
- package/components/skeleton/skeleton.yaml +1 -1
- package/components/slider/slider.a2ui.json +1 -1
- package/components/slider/slider.js +7 -7
- package/components/slider/slider.yaml +1 -1
- package/components/stack/stack.a2ui.json +1 -1
- package/components/stack/stack.js +4 -4
- package/components/stack/stack.yaml +1 -1
- package/components/stat/stat.a2ui.json +1 -1
- package/components/stat/stat.js +4 -4
- package/components/stat/stat.yaml +1 -1
- package/components/stepper/stepper.a2ui.json +1 -1
- package/components/stepper/stepper.js +6 -6
- package/components/stepper/stepper.yaml +1 -1
- package/components/stream/stream.a2ui.json +1 -1
- package/components/stream/stream.js +4 -4
- package/components/stream/stream.yaml +1 -1
- package/components/swatch/swatch.a2ui.json +1 -1
- package/components/swatch/swatch.js +4 -4
- package/components/swatch/swatch.yaml +1 -1
- package/components/swiper/swiper.a2ui.json +1 -1
- package/components/swiper/swiper.js +4 -4
- package/components/swiper/swiper.yaml +1 -1
- package/components/switch/switch.a2ui.json +1 -1
- package/components/switch/switch.js +5 -5
- package/components/switch/switch.yaml +1 -1
- package/components/table/table.a2ui.json +1 -1
- package/components/table/table.js +4 -4
- package/components/table/table.yaml +1 -1
- package/components/table-toolbar/table-toolbar.a2ui.json +1 -1
- package/components/table-toolbar/table-toolbar.js +4 -4
- package/components/table-toolbar/table-toolbar.yaml +1 -1
- package/components/tabs/tab.js +4 -4
- package/components/tabs/tabs.a2ui.json +1 -1
- package/components/tabs/tabs.js +5 -5
- package/components/tabs/tabs.yaml +1 -1
- package/components/tag/tag.a2ui.json +1 -1
- package/components/tag/tag.js +4 -4
- package/components/tag/tag.yaml +1 -1
- package/components/text/text.a2ui.json +1 -1
- package/components/text/text.js +4 -4
- package/components/text/text.yaml +1 -1
- package/components/textarea/textarea.a2ui.json +1 -1
- package/components/textarea/textarea.js +5 -5
- package/components/textarea/textarea.yaml +1 -1
- package/components/timeline/timeline.a2ui.json +1 -1
- package/components/timeline/timeline.js +6 -6
- package/components/timeline/timeline.yaml +1 -1
- package/components/toast/toast.a2ui.json +1 -1
- package/components/toast/toast.js +54 -184
- package/components/toast/toast.yaml +1 -1
- package/components/toggle-group/toggle-group.a2ui.json +1 -1
- package/components/toggle-group/toggle-group.js +6 -6
- package/components/toggle-group/toggle-group.yaml +1 -1
- package/components/toolbar/toolbar.a2ui.json +1 -1
- package/components/toolbar/toolbar.js +6 -6
- package/components/toolbar/toolbar.yaml +1 -1
- package/components/tooltip/tooltip.a2ui.json +1 -1
- package/components/tooltip/tooltip.js +7 -7
- package/components/tooltip/tooltip.yaml +1 -1
- package/components/tree/tree.a2ui.json +1 -1
- package/components/tree/tree.js +6 -6
- package/components/tree/tree.yaml +1 -1
- package/components/upload/upload.a2ui.json +1 -1
- package/components/upload/upload.js +6 -6
- package/components/upload/upload.yaml +1 -1
- package/core/element.js +4 -4
- package/core/element.test.js +18 -18
- package/core/form.js +9 -9
- package/core/index.js +2 -2
- package/core/provider.js +7 -7
- package/core/template.js +1 -1
- package/index.css +3 -2
- package/index.js +17 -7
- package/package.json +1 -5
- package/styles/components.css +10 -6
- package/styles/resets.css +1 -1
- package/traits/define.js +2 -2
- package/patterns/a2ui-root/a2ui-root.a2ui.json +0 -125
- package/patterns/a2ui-root/a2ui-root.js +0 -191
- package/patterns/a2ui-root/a2ui-root.yaml +0 -87
- package/patterns/adia-chat/adia-chat.a2ui.json +0 -149
- package/patterns/adia-chat/adia-chat.css +0 -10
- package/patterns/adia-chat/adia-chat.js +0 -297
- package/patterns/adia-chat/adia-chat.yaml +0 -118
- package/patterns/adia-chat/css/adia-chat.empty.css +0 -12
- package/patterns/adia-chat/css/adia-chat.layout.css +0 -60
- package/patterns/adia-chat/css/adia-chat.markdown.css +0 -74
- package/patterns/adia-chat/css/adia-chat.messages.css +0 -87
- package/patterns/adia-chat/css/adia-chat.streaming.css +0 -30
- package/patterns/adia-chat/css/adia-chat.tokens.css +0 -95
- package/patterns/adia-editor/adia-editor.a2ui.json +0 -73
- package/patterns/adia-editor/adia-editor.css +0 -6
- package/patterns/adia-editor/adia-editor.js +0 -56
- package/patterns/adia-editor/adia-editor.yaml +0 -59
- package/patterns/adia-editor/css/adia-editor.layout.css +0 -171
- package/patterns/adia-editor/css/adia-editor.tokens.css +0 -28
- package/patterns/app-nav/app-nav.a2ui.json +0 -89
- package/patterns/app-nav/app-nav.css +0 -92
- package/patterns/app-nav/app-nav.js +0 -112
- package/patterns/app-nav/app-nav.yaml +0 -54
- package/patterns/app-nav-group/app-nav-group.a2ui.json +0 -82
- package/patterns/app-nav-group/app-nav-group.yaml +0 -59
- package/patterns/app-nav-item/app-nav-item.a2ui.json +0 -83
- package/patterns/app-nav-item/app-nav-item.js +0 -42
- package/patterns/app-nav-item/app-nav-item.yaml +0 -62
- package/patterns/app-shell/app-shell.a2ui.json +0 -129
- package/patterns/app-shell/app-shell.css +0 -14
- package/patterns/app-shell/app-shell.js +0 -251
- package/patterns/app-shell/app-shell.yaml +0 -89
- package/patterns/app-shell/css/app-shell.collapsed.css +0 -86
- package/patterns/app-shell/css/app-shell.helpers.css +0 -42
- package/patterns/app-shell/css/app-shell.main.css +0 -172
- package/patterns/app-shell/css/app-shell.shell.css +0 -44
- package/patterns/app-shell/css/app-shell.sidebar.css +0 -161
- package/patterns/app-shell/css/app-shell.templates.css +0 -214
- package/patterns/app-shell/css/app-shell.tokens.css +0 -119
- package/patterns/gen-ui/gen-ui.a2ui.json +0 -72
- package/patterns/gen-ui/gen-ui.css +0 -83
- package/patterns/gen-ui/gen-ui.js +0 -136
- package/patterns/gen-ui/gen-ui.yaml +0 -43
- package/patterns/index.js +0 -11
- package/patterns/section-nav/section-nav.a2ui.json +0 -91
- package/patterns/section-nav/section-nav.css +0 -60
- package/patterns/section-nav/section-nav.js +0 -42
- package/patterns/section-nav/section-nav.yaml +0 -58
- package/patterns/section-nav-group/section-nav-group.a2ui.json +0 -95
- package/patterns/section-nav-group/section-nav-group.css +0 -74
- package/patterns/section-nav-group/section-nav-group.js +0 -84
- package/patterns/section-nav-group/section-nav-group.yaml +0 -66
- package/patterns/section-nav-item/section-nav-item.a2ui.json +0 -97
- package/patterns/section-nav-item/section-nav-item.css +0 -106
- package/patterns/section-nav-item/section-nav-item.js +0 -66
- package/patterns/section-nav-item/section-nav-item.yaml +0 -70
- package/styles/layouts/admin.css +0 -7
- /package/components/{chat → chat-thread}/chat-input.css +0 -0
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* <a2ui-root> — A2UI protocol surface.
|
|
3
|
-
* Connects to a stream source and renders A2UI messages as AdiaUI components.
|
|
4
|
-
*
|
|
5
|
-
* <a2ui-root src="/api/agent" transport="sse"></a2ui-root>
|
|
6
|
-
* <a2ui-root src="ws://localhost:8080" transport="ws"></a2ui-root>
|
|
7
|
-
*
|
|
8
|
-
* Static / author-driven mode — set the `doc` property (array of A2UI messages)
|
|
9
|
-
* and the renderer resets + replays them. Editors and previews can drive the
|
|
10
|
-
* surface without opening a transport. Setting `doc` to a new array re-renders
|
|
11
|
-
* from scratch (reset() + processAll()).
|
|
12
|
-
*
|
|
13
|
-
* const root = document.querySelector('a2ui-root');
|
|
14
|
-
* root.doc = [
|
|
15
|
-
* { type: 'createSurface', surfaceId: 'root', root: 'c-1' },
|
|
16
|
-
* { type: 'updateComponents', components: [{ id: 'c-1', component: 'Heading', text: 'Hi' }] },
|
|
17
|
-
* ];
|
|
18
|
-
*
|
|
19
|
-
* Events:
|
|
20
|
-
* a2ui-connected — stream connected
|
|
21
|
-
* a2ui-message — each message received (detail: { message })
|
|
22
|
-
* a2ui-error — stream error (detail: { error })
|
|
23
|
-
* a2ui-closed — stream ended
|
|
24
|
-
* a2ui-action — user interaction (detail: { name, sourceComponentId, context })
|
|
25
|
-
* doc-replaced — fired after a full doc reset + replay (author-driven mode)
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import { AdiaElement } from '../../core/element.js';
|
|
29
|
-
import {
|
|
30
|
-
A2UIRenderer,
|
|
31
|
-
registry,
|
|
32
|
-
sseStream,
|
|
33
|
-
wsStream,
|
|
34
|
-
jsonlStream,
|
|
35
|
-
mcpStream,
|
|
36
|
-
} from '@adia-ai/a2ui-utils';
|
|
37
|
-
|
|
38
|
-
class AdiaA2UIRoot extends AdiaElement {
|
|
39
|
-
static properties = {
|
|
40
|
-
src: { type: String, default: '', reflect: true },
|
|
41
|
-
transport: { type: String, default: 'sse', reflect: true },
|
|
42
|
-
loading: { type: Boolean, default: false, reflect: true },
|
|
43
|
-
active: { type: Boolean, default: false, reflect: true },
|
|
44
|
-
batch: { type: Boolean, default: false, reflect: true },
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
static template = () => null;
|
|
48
|
-
|
|
49
|
-
#renderer = null;
|
|
50
|
-
#abortCtrl = null;
|
|
51
|
-
#doc = null;
|
|
52
|
-
#bound = false;
|
|
53
|
-
|
|
54
|
-
#onClick = (e) => {
|
|
55
|
-
const actionEl = e.target.closest('[data-action]');
|
|
56
|
-
if (!actionEl) return;
|
|
57
|
-
this.dispatchEvent(new CustomEvent('a2ui-action', {
|
|
58
|
-
bubbles: true,
|
|
59
|
-
detail: {
|
|
60
|
-
name: actionEl.getAttribute('data-action'),
|
|
61
|
-
sourceComponentId: actionEl.getAttribute('data-a2ui-id') || '',
|
|
62
|
-
timestamp: Date.now(),
|
|
63
|
-
context: {},
|
|
64
|
-
},
|
|
65
|
-
}));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
connected() {
|
|
69
|
-
this.#renderer = new A2UIRenderer(this, registry, { batch: this.batch });
|
|
70
|
-
|
|
71
|
-
if (!this.#bound) {
|
|
72
|
-
this.#bound = true;
|
|
73
|
-
this.addEventListener('click', this.#onClick);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
render() {
|
|
78
|
-
if (this.src && !this.active) this.#connect();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async #connect() {
|
|
82
|
-
this.#abortCtrl?.abort();
|
|
83
|
-
this.#abortCtrl = new AbortController();
|
|
84
|
-
const signal = this.#abortCtrl.signal;
|
|
85
|
-
|
|
86
|
-
this.loading = true;
|
|
87
|
-
this.active = false;
|
|
88
|
-
|
|
89
|
-
let stream;
|
|
90
|
-
try {
|
|
91
|
-
switch (this.transport) {
|
|
92
|
-
case 'sse':
|
|
93
|
-
stream = sseStream(this.src, { signal, catalog: registry });
|
|
94
|
-
break;
|
|
95
|
-
case 'ws':
|
|
96
|
-
case 'websocket':
|
|
97
|
-
stream = wsStream(this.src, { signal, catalog: registry });
|
|
98
|
-
break;
|
|
99
|
-
case 'jsonl':
|
|
100
|
-
stream = jsonlStream(this.src, { signal, catalog: registry });
|
|
101
|
-
break;
|
|
102
|
-
case 'mcp':
|
|
103
|
-
stream = mcpStream(this.src, {
|
|
104
|
-
signal,
|
|
105
|
-
catalog: registry,
|
|
106
|
-
onAction: (name, params) => {
|
|
107
|
-
this.dispatchEvent(new CustomEvent('a2ui-action', {
|
|
108
|
-
bubbles: true,
|
|
109
|
-
detail: { name, params, timestamp: Date.now() },
|
|
110
|
-
}));
|
|
111
|
-
return Promise.resolve({ status: 'dispatched' });
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
break;
|
|
115
|
-
default:
|
|
116
|
-
console.warn(`a2ui-root: unknown transport "${this.transport}"`);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
this.active = true;
|
|
121
|
-
this.loading = false;
|
|
122
|
-
this.dispatchEvent(new Event('a2ui-connected', { bubbles: true }));
|
|
123
|
-
|
|
124
|
-
for await (const message of stream) {
|
|
125
|
-
if (signal.aborted) break;
|
|
126
|
-
this.#renderer.process(message);
|
|
127
|
-
this.dispatchEvent(new CustomEvent('a2ui-message', {
|
|
128
|
-
bubbles: true,
|
|
129
|
-
detail: { message },
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
} catch (err) {
|
|
133
|
-
if (!signal.aborted) {
|
|
134
|
-
this.dispatchEvent(new CustomEvent('a2ui-error', {
|
|
135
|
-
bubbles: true,
|
|
136
|
-
detail: { error: err },
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
this.active = false;
|
|
142
|
-
this.loading = false;
|
|
143
|
-
this.dispatchEvent(new Event('a2ui-closed', { bubbles: true }));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
process(message) {
|
|
147
|
-
if (!this.#renderer) {
|
|
148
|
-
this.#renderer = new A2UIRenderer(this, registry);
|
|
149
|
-
}
|
|
150
|
-
this.#renderer.process(message);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
processAll(messages) {
|
|
154
|
-
for (const msg of messages) this.process(msg);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
get doc() { return this.#doc; }
|
|
158
|
-
set doc(messages) {
|
|
159
|
-
this.#doc = Array.isArray(messages) ? messages : [];
|
|
160
|
-
if (!this.#renderer) {
|
|
161
|
-
this.#renderer = new A2UIRenderer(this, registry);
|
|
162
|
-
}
|
|
163
|
-
this.#renderer.reset();
|
|
164
|
-
for (const msg of this.#doc) this.#renderer.process(msg);
|
|
165
|
-
this.dispatchEvent(new CustomEvent('doc-replaced', {
|
|
166
|
-
bubbles: true,
|
|
167
|
-
detail: { count: this.#doc.length },
|
|
168
|
-
}));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
reset() {
|
|
172
|
-
this.#renderer?.reset();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
disconnect() {
|
|
176
|
-
this.#abortCtrl?.abort();
|
|
177
|
-
this.active = false;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
disconnected() {
|
|
181
|
-
this.#abortCtrl?.abort();
|
|
182
|
-
this.removeEventListener('click', this.#onClick);
|
|
183
|
-
this.#bound = false;
|
|
184
|
-
this.active = false;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
get renderer() { return this.#renderer; }
|
|
188
|
-
}
|
|
189
|
-
customElements.define('a2ui-root', AdiaA2UIRoot);
|
|
190
|
-
|
|
191
|
-
export { AdiaA2UIRoot };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# Edit this file; run `npm run build:components` to regenerate a2ui.json.
|
|
2
|
-
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
3
|
-
name: AdiaA2UIRoot
|
|
4
|
-
tag: a2ui-root
|
|
5
|
-
component: A2UIRoot
|
|
6
|
-
category: container
|
|
7
|
-
version: 1
|
|
8
|
-
description: A2UI protocol surface. Connects to a stream source (SSE, WebSocket, JSONL, MCP) and renders A2UI messages as AdiaUI components via the `@adia-ai/a2ui-utils` renderer.
|
|
9
|
-
props:
|
|
10
|
-
src:
|
|
11
|
-
description: Stream source URL (endpoint for SSE/WebSocket, file path for JSONL, tool-call target for MCP).
|
|
12
|
-
type: string
|
|
13
|
-
default: ""
|
|
14
|
-
transport:
|
|
15
|
-
description: Stream transport to use.
|
|
16
|
-
type: string
|
|
17
|
-
default: sse
|
|
18
|
-
enum:
|
|
19
|
-
- sse
|
|
20
|
-
- ws
|
|
21
|
-
- websocket
|
|
22
|
-
- jsonl
|
|
23
|
-
- mcp
|
|
24
|
-
loading:
|
|
25
|
-
description: True while the stream is connecting.
|
|
26
|
-
type: boolean
|
|
27
|
-
default: false
|
|
28
|
-
reflect: true
|
|
29
|
-
active:
|
|
30
|
-
description: True while the stream is connected and receiving messages.
|
|
31
|
-
type: boolean
|
|
32
|
-
default: false
|
|
33
|
-
reflect: true
|
|
34
|
-
batch:
|
|
35
|
-
description: Batch renderer updates via requestAnimationFrame for large fan-in.
|
|
36
|
-
type: boolean
|
|
37
|
-
default: false
|
|
38
|
-
doc:
|
|
39
|
-
description: >-
|
|
40
|
-
Author-driven mode — set to an array of A2UI messages and the renderer
|
|
41
|
-
resets + replays them. No network/transport involvement. Setting to a
|
|
42
|
-
new array triggers a full re-render. Use this for editors, previews,
|
|
43
|
-
tests, and any static-doc authoring loop. When both `src` and `doc` are
|
|
44
|
-
set, `doc` wins (the stream is not opened). Pass as a JS property; not
|
|
45
|
-
reflected to an attribute.
|
|
46
|
-
type: array
|
|
47
|
-
events:
|
|
48
|
-
a2ui-connected:
|
|
49
|
-
description: Fired when the stream is established.
|
|
50
|
-
a2ui-message:
|
|
51
|
-
description: "Fired for each A2UI message received. detail: { message }"
|
|
52
|
-
a2ui-action:
|
|
53
|
-
description: "Fired when a child element with [data-action] is clicked. detail: { name, sourceComponentId, context }"
|
|
54
|
-
a2ui-error:
|
|
55
|
-
description: "Fired when the stream errors. detail: { error }"
|
|
56
|
-
a2ui-closed:
|
|
57
|
-
description: Fired when the stream ends.
|
|
58
|
-
doc-replaced:
|
|
59
|
-
description: "Fired after a full doc reset + replay in author-driven mode. detail: { count }"
|
|
60
|
-
slots:
|
|
61
|
-
default:
|
|
62
|
-
description: The rendered surface. Children are stamped by the A2UI renderer.
|
|
63
|
-
states:
|
|
64
|
-
- name: idle
|
|
65
|
-
description: Default, ready to connect.
|
|
66
|
-
- name: loading
|
|
67
|
-
description: Stream is connecting.
|
|
68
|
-
- name: active
|
|
69
|
-
description: Stream is connected and receiving messages.
|
|
70
|
-
traits: []
|
|
71
|
-
tokens: {}
|
|
72
|
-
a2ui:
|
|
73
|
-
rules: []
|
|
74
|
-
anti_patterns: []
|
|
75
|
-
keywords:
|
|
76
|
-
- a2ui
|
|
77
|
-
- protocol
|
|
78
|
-
- renderer
|
|
79
|
-
- stream
|
|
80
|
-
- surface
|
|
81
|
-
- sse
|
|
82
|
-
- websocket
|
|
83
|
-
- jsonl
|
|
84
|
-
- mcp
|
|
85
|
-
related:
|
|
86
|
-
- canvas
|
|
87
|
-
- inspector
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://adiaui.dev/a2ui/v0_9/components/Chat.json",
|
|
4
|
-
"title": "Chat",
|
|
5
|
-
"description": "Behavior-only chat orchestrator. Author supplies the DOM structure via\n[data-chat-messages], [data-chat-input], [data-chat-empty], [data-chat-status]\nelements; adia-chat wires message streaming, markdown rendering, code-block\nupgrades, and an LLM integration path via proxy-url (or via external submit).\n",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"allOf": [
|
|
8
|
-
{
|
|
9
|
-
"$ref": "common_types.json#/$defs/ComponentCommon"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"$ref": "common_types.json#/$defs/CatalogComponentCommon"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"properties": {
|
|
16
|
-
"component": {
|
|
17
|
-
"const": "Chat"
|
|
18
|
-
},
|
|
19
|
-
"model": {
|
|
20
|
-
"description": "Model identifier.",
|
|
21
|
-
"type": "string",
|
|
22
|
-
"default": ""
|
|
23
|
-
},
|
|
24
|
-
"provider": {
|
|
25
|
-
"description": "LLM provider name (anthropic | openai | google | stub).",
|
|
26
|
-
"type": "string",
|
|
27
|
-
"default": ""
|
|
28
|
-
},
|
|
29
|
-
"proxyUrl": {
|
|
30
|
-
"description": "API proxy endpoint for LLM calls; enables self-contained chat without external wiring.",
|
|
31
|
-
"type": "string",
|
|
32
|
-
"default": ""
|
|
33
|
-
},
|
|
34
|
-
"streaming": {
|
|
35
|
-
"description": "Active streaming indicator; toggled while a response is being received.",
|
|
36
|
-
"type": "boolean",
|
|
37
|
-
"default": false
|
|
38
|
-
},
|
|
39
|
-
"system": {
|
|
40
|
-
"description": "System prompt prepended to conversations.",
|
|
41
|
-
"type": "string",
|
|
42
|
-
"default": ""
|
|
43
|
-
},
|
|
44
|
-
"thinking": {
|
|
45
|
-
"description": "Enable Anthropic extended-thinking mode.",
|
|
46
|
-
"type": "boolean",
|
|
47
|
-
"default": false
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"required": [
|
|
51
|
-
"component"
|
|
52
|
-
],
|
|
53
|
-
"unevaluatedProperties": false,
|
|
54
|
-
"x-adiaui": {
|
|
55
|
-
"anti_patterns": [],
|
|
56
|
-
"category": "container",
|
|
57
|
-
"events": {
|
|
58
|
-
"abort": {
|
|
59
|
-
"description": "Fired when the user aborts an in-flight request."
|
|
60
|
-
},
|
|
61
|
-
"chunk": {
|
|
62
|
-
"description": "Fired for each streaming chunk.",
|
|
63
|
-
"detail": {
|
|
64
|
-
"snapshot": "string",
|
|
65
|
-
"text": "string"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"clear": {
|
|
69
|
-
"description": "Fired when the conversation is cleared."
|
|
70
|
-
},
|
|
71
|
-
"done": {
|
|
72
|
-
"description": "Fired when a response completes.",
|
|
73
|
-
"detail": {
|
|
74
|
-
"stopReason": "string",
|
|
75
|
-
"text": "string",
|
|
76
|
-
"usage": "object"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"error": {
|
|
80
|
-
"description": "Fired on any LLM / network error.",
|
|
81
|
-
"detail": {
|
|
82
|
-
"error": "Error"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"message": {
|
|
86
|
-
"description": "Fired after each message (user or assistant) is appended.",
|
|
87
|
-
"detail": {
|
|
88
|
-
"content": "string",
|
|
89
|
-
"id": "string",
|
|
90
|
-
"role": "string"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
"submit": {
|
|
94
|
-
"description": "Fired on user message submit (before LLM call begins).",
|
|
95
|
-
"detail": {
|
|
96
|
-
"model": "string",
|
|
97
|
-
"text": "string"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"thinking": {
|
|
101
|
-
"description": "Fired when the model emits extended-thinking content.",
|
|
102
|
-
"detail": {
|
|
103
|
-
"text": "string"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"examples": [],
|
|
108
|
-
"keywords": [
|
|
109
|
-
"adia-chat",
|
|
110
|
-
"chat",
|
|
111
|
-
"llm",
|
|
112
|
-
"streaming",
|
|
113
|
-
"conversation",
|
|
114
|
-
"agent"
|
|
115
|
-
],
|
|
116
|
-
"name": "AdiaChatElement",
|
|
117
|
-
"related": [
|
|
118
|
-
"ChatInput",
|
|
119
|
-
"Code"
|
|
120
|
-
],
|
|
121
|
-
"slots": {
|
|
122
|
-
"default": {
|
|
123
|
-
"description": "Author provides the structural DOM. Expected markers — [data-chat-messages] (message list), [data-chat-input] (input surface), [data-chat-empty] (empty state), [data-chat-status] (streaming indicator)."
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
"states": [
|
|
127
|
-
{
|
|
128
|
-
"description": "No active request.",
|
|
129
|
-
"name": "idle"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"description": "An LLM request is in-flight; [data-chat-status] visible.",
|
|
133
|
-
"attribute": "streaming",
|
|
134
|
-
"name": "streaming"
|
|
135
|
-
}
|
|
136
|
-
],
|
|
137
|
-
"synonyms": {
|
|
138
|
-
"chat": [
|
|
139
|
-
"conversation",
|
|
140
|
-
"messages",
|
|
141
|
-
"thread"
|
|
142
|
-
]
|
|
143
|
-
},
|
|
144
|
-
"tag": "adia-chat-ui",
|
|
145
|
-
"tokens": {},
|
|
146
|
-
"traits": [],
|
|
147
|
-
"version": 1
|
|
148
|
-
}
|
|
149
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/* ═══════════════════════════════════════════════════════════════
|
|
2
|
-
adia-chat — Pattern component CSS
|
|
3
|
-
═══════════════════════════════════════════════════════════════ */
|
|
4
|
-
|
|
5
|
-
@import "./css/adia-chat.tokens.css";
|
|
6
|
-
@import "./css/adia-chat.layout.css";
|
|
7
|
-
@import "./css/adia-chat.messages.css";
|
|
8
|
-
@import "./css/adia-chat.streaming.css";
|
|
9
|
-
@import "./css/adia-chat.markdown.css";
|
|
10
|
-
@import "./css/adia-chat.empty.css";
|