@mihcm/ai-ui 0.14.1
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 +100 -0
- package/dist/coverage.d.ts +17 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +320 -0
- package/dist/coverage.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/renderer.d.ts +36 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +413 -0
- package/dist/renderer.js.map +1 -0
- package/dist/schemas/Accordion.d.ts +25 -0
- package/dist/schemas/Accordion.d.ts.map +1 -0
- package/dist/schemas/Accordion.js +26 -0
- package/dist/schemas/Accordion.js.map +1 -0
- package/dist/schemas/Alert.d.ts +24 -0
- package/dist/schemas/Alert.d.ts.map +1 -0
- package/dist/schemas/Alert.js +20 -0
- package/dist/schemas/Alert.js.map +1 -0
- package/dist/schemas/AlertDialog.d.ts +29 -0
- package/dist/schemas/AlertDialog.d.ts.map +1 -0
- package/dist/schemas/AlertDialog.js +22 -0
- package/dist/schemas/AlertDialog.js.map +1 -0
- package/dist/schemas/Avatar.d.ts +29 -0
- package/dist/schemas/Avatar.d.ts.map +1 -0
- package/dist/schemas/Avatar.js +21 -0
- package/dist/schemas/Avatar.js.map +1 -0
- package/dist/schemas/AvatarGroup.d.ts +22 -0
- package/dist/schemas/AvatarGroup.d.ts.map +1 -0
- package/dist/schemas/AvatarGroup.js +23 -0
- package/dist/schemas/AvatarGroup.js.map +1 -0
- package/dist/schemas/Badge.d.ts +23 -0
- package/dist/schemas/Badge.d.ts.map +1 -0
- package/dist/schemas/Badge.js +19 -0
- package/dist/schemas/Badge.js.map +1 -0
- package/dist/schemas/Banner.d.ts +23 -0
- package/dist/schemas/Banner.d.ts.map +1 -0
- package/dist/schemas/Banner.js +20 -0
- package/dist/schemas/Banner.js.map +1 -0
- package/dist/schemas/Breadcrumb.d.ts +20 -0
- package/dist/schemas/Breadcrumb.d.ts.map +1 -0
- package/dist/schemas/Breadcrumb.js +25 -0
- package/dist/schemas/Breadcrumb.js.map +1 -0
- package/dist/schemas/Button.d.ts +40 -0
- package/dist/schemas/Button.d.ts.map +1 -0
- package/dist/schemas/Button.js +26 -0
- package/dist/schemas/Button.js.map +1 -0
- package/dist/schemas/Card.d.ts +21 -0
- package/dist/schemas/Card.d.ts.map +1 -0
- package/dist/schemas/Card.js +22 -0
- package/dist/schemas/Card.js.map +1 -0
- package/dist/schemas/Checkbox.d.ts +18 -0
- package/dist/schemas/Checkbox.d.ts.map +1 -0
- package/dist/schemas/Checkbox.js +19 -0
- package/dist/schemas/Checkbox.js.map +1 -0
- package/dist/schemas/Dialog.d.ts +24 -0
- package/dist/schemas/Dialog.d.ts.map +1 -0
- package/dist/schemas/Dialog.js +20 -0
- package/dist/schemas/Dialog.js.map +1 -0
- package/dist/schemas/DropdownMenu.d.ts +25 -0
- package/dist/schemas/DropdownMenu.d.ts.map +1 -0
- package/dist/schemas/DropdownMenu.js +29 -0
- package/dist/schemas/DropdownMenu.js.map +1 -0
- package/dist/schemas/EmptyState.d.ts +16 -0
- package/dist/schemas/EmptyState.d.ts.map +1 -0
- package/dist/schemas/EmptyState.js +17 -0
- package/dist/schemas/EmptyState.js.map +1 -0
- package/dist/schemas/Input.d.ts +42 -0
- package/dist/schemas/Input.d.ts.map +1 -0
- package/dist/schemas/Input.js +31 -0
- package/dist/schemas/Input.js.map +1 -0
- package/dist/schemas/Label.d.ts +24 -0
- package/dist/schemas/Label.d.ts.map +1 -0
- package/dist/schemas/Label.js +21 -0
- package/dist/schemas/Label.js.map +1 -0
- package/dist/schemas/Link.d.ts +30 -0
- package/dist/schemas/Link.d.ts.map +1 -0
- package/dist/schemas/Link.js +22 -0
- package/dist/schemas/Link.js.map +1 -0
- package/dist/schemas/Pagination.d.ts +19 -0
- package/dist/schemas/Pagination.d.ts.map +1 -0
- package/dist/schemas/Pagination.js +20 -0
- package/dist/schemas/Pagination.js.map +1 -0
- package/dist/schemas/Progress.d.ts +27 -0
- package/dist/schemas/Progress.d.ts.map +1 -0
- package/dist/schemas/Progress.js +20 -0
- package/dist/schemas/Progress.js.map +1 -0
- package/dist/schemas/RadioGroup.d.ts +25 -0
- package/dist/schemas/RadioGroup.d.ts.map +1 -0
- package/dist/schemas/RadioGroup.js +26 -0
- package/dist/schemas/RadioGroup.js.map +1 -0
- package/dist/schemas/SectionHeader.d.ts +160 -0
- package/dist/schemas/SectionHeader.d.ts.map +1 -0
- package/dist/schemas/SectionHeader.js +52 -0
- package/dist/schemas/SectionHeader.js.map +1 -0
- package/dist/schemas/Select.d.ts +38 -0
- package/dist/schemas/Select.d.ts.map +1 -0
- package/dist/schemas/Select.js +36 -0
- package/dist/schemas/Select.js.map +1 -0
- package/dist/schemas/Separator.d.ts +16 -0
- package/dist/schemas/Separator.d.ts.map +1 -0
- package/dist/schemas/Separator.js +14 -0
- package/dist/schemas/Separator.js.map +1 -0
- package/dist/schemas/Sheet.d.ts +28 -0
- package/dist/schemas/Sheet.d.ts.map +1 -0
- package/dist/schemas/Sheet.js +20 -0
- package/dist/schemas/Sheet.js.map +1 -0
- package/dist/schemas/Stack.d.ts +58 -0
- package/dist/schemas/Stack.d.ts.map +1 -0
- package/dist/schemas/Stack.js +80 -0
- package/dist/schemas/Stack.js.map +1 -0
- package/dist/schemas/StatCard.d.ts +30 -0
- package/dist/schemas/StatCard.d.ts.map +1 -0
- package/dist/schemas/StatCard.js +26 -0
- package/dist/schemas/StatCard.js.map +1 -0
- package/dist/schemas/StatusBadge.d.ts +25 -0
- package/dist/schemas/StatusBadge.d.ts.map +1 -0
- package/dist/schemas/StatusBadge.js +20 -0
- package/dist/schemas/StatusBadge.js.map +1 -0
- package/dist/schemas/Switch.d.ts +23 -0
- package/dist/schemas/Switch.d.ts.map +1 -0
- package/dist/schemas/Switch.js +20 -0
- package/dist/schemas/Switch.js.map +1 -0
- package/dist/schemas/Table.d.ts +20 -0
- package/dist/schemas/Table.d.ts.map +1 -0
- package/dist/schemas/Table.js +24 -0
- package/dist/schemas/Table.js.map +1 -0
- package/dist/schemas/Tabs.d.ts +21 -0
- package/dist/schemas/Tabs.d.ts.map +1 -0
- package/dist/schemas/Tabs.js +25 -0
- package/dist/schemas/Tabs.js.map +1 -0
- package/dist/schemas/Tag.d.ts +29 -0
- package/dist/schemas/Tag.d.ts.map +1 -0
- package/dist/schemas/Tag.js +21 -0
- package/dist/schemas/Tag.js.map +1 -0
- package/dist/schemas/Text.d.ts +51 -0
- package/dist/schemas/Text.d.ts.map +1 -0
- package/dist/schemas/Text.js +21 -0
- package/dist/schemas/Text.js.map +1 -0
- package/dist/schemas/Textarea.d.ts +25 -0
- package/dist/schemas/Textarea.d.ts.map +1 -0
- package/dist/schemas/Textarea.js +24 -0
- package/dist/schemas/Textarea.js.map +1 -0
- package/dist/schemas/TitleBar.d.ts +18 -0
- package/dist/schemas/TitleBar.d.ts.map +1 -0
- package/dist/schemas/TitleBar.js +19 -0
- package/dist/schemas/TitleBar.js.map +1 -0
- package/dist/schemas/Toggle.d.ts +28 -0
- package/dist/schemas/Toggle.d.ts.map +1 -0
- package/dist/schemas/Toggle.js +22 -0
- package/dist/schemas/Toggle.js.map +1 -0
- package/dist/schemas/index.d.ts +694 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +160 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/shared.d.ts +4 -0
- package/dist/schemas/shared.d.ts.map +1 -0
- package/dist/schemas/shared.js +23 -0
- package/dist/schemas/shared.js.map +1 -0
- package/dist/tools.d.ts +1293 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +40 -0
- package/dist/tools.js.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @mihcm/ai-ui
|
|
2
|
+
|
|
3
|
+
Zod-validated component descriptors and a safe renderer for AI-generated MiHCM UI.
|
|
4
|
+
|
|
5
|
+
This package is the only approved path for rendering model-generated UI. It keeps AI output constrained to an explicit component allowlist and validates every descriptor before render.
|
|
6
|
+
|
|
7
|
+
## Current release
|
|
8
|
+
|
|
9
|
+
Current published version: **0.14.1**.
|
|
10
|
+
|
|
11
|
+
This release follows `@mihcm/ui@0.14.1`. Descriptor validation and the renderer allowlist remain unchanged; the package stays aligned with the current UI surface and dependency train.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @mihcm/ai-ui @mihcm/ui zod
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { renderComponentDescriptor, componentDescriptorSchema } from '@mihcm/ai-ui';
|
|
23
|
+
|
|
24
|
+
const descriptor = componentDescriptorSchema.parse({
|
|
25
|
+
component: 'Button',
|
|
26
|
+
props: {
|
|
27
|
+
children: 'Approve request',
|
|
28
|
+
variant: 'default',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export function GeneratedAction() {
|
|
33
|
+
return renderComponentDescriptor(descriptor);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## What is included
|
|
38
|
+
|
|
39
|
+
- Zod schemas for supported MiHCM component descriptors.
|
|
40
|
+
- Shared safe schemas for text, class names, relative URLs, and HTTPS image URLs.
|
|
41
|
+
- Renderer switch for allowlisted components only.
|
|
42
|
+
- AI tool descriptions that reflect the live allowlist.
|
|
43
|
+
- Coverage governance that marks each UI primitive as `supported`, `host-composed`, or `blocked`.
|
|
44
|
+
|
|
45
|
+
## Recent additions and fixes
|
|
46
|
+
|
|
47
|
+
- Added the `Link` descriptor and renderer case with safe relative, hash, or HTTPS href validation.
|
|
48
|
+
- Added semantic `Text.as` support for safe `span`, paragraph, label, emphasis, and heading tags.
|
|
49
|
+
- Updated coverage guidance so `Button`, `Link`, `Text`, and form-like descriptors preserve native HTML semantics and accessible names.
|
|
50
|
+
- Extended the `SectionHeader` descriptor with safe enum-backed spacing, surface, border, radius, and shadow props; raw class names remain host-owned.
|
|
51
|
+
- Added `AI_UI_COMPONENT_COVERAGE` so every UI primitive has an explicit AI-UI decision.
|
|
52
|
+
- Added the coverage test script that verifies coverage, schema files, renderer cases, and tool-prompt allowlist sync.
|
|
53
|
+
- Tightened URL validation for model-controlled Avatar images and Breadcrumb hrefs.
|
|
54
|
+
- Added shared safe URL schemas to prevent raw `z.string().url()` from allowing unsafe schemes.
|
|
55
|
+
- Updated tool descriptions to derive from the live allowlist instead of stale hardcoded examples.
|
|
56
|
+
|
|
57
|
+
## Security contract
|
|
58
|
+
|
|
59
|
+
- Never use `eval`, `new Function`, dynamic imports, or model-provided component paths.
|
|
60
|
+
- Never render raw HTML from a descriptor.
|
|
61
|
+
- Never accept model-controlled filesystem paths.
|
|
62
|
+
- Only render components in the explicit allowlist.
|
|
63
|
+
- Validate descriptors with Zod before rendering.
|
|
64
|
+
- Validate navigation hrefs with `safeHrefSchema`; reject `javascript:`, protocol-relative URLs, and arbitrary schemes.
|
|
65
|
+
- Keep generated text structural: use `Text.as` for headings and paragraphs instead of relying on visual size alone.
|
|
66
|
+
- Keep unsafe or host-owned primitives marked as `host-composed` or `blocked`.
|
|
67
|
+
|
|
68
|
+
## Supported vs host-composed
|
|
69
|
+
|
|
70
|
+
`supported` means a model may emit the descriptor directly.
|
|
71
|
+
|
|
72
|
+
`host-composed` means the host application owns state, async data, callbacks, or layout context and may compose the component itself after validating model intent.
|
|
73
|
+
|
|
74
|
+
`blocked` means the primitive is not safe or useful for model-controlled render output.
|
|
75
|
+
|
|
76
|
+
## Maintainer checklist
|
|
77
|
+
|
|
78
|
+
When changing UI primitives:
|
|
79
|
+
|
|
80
|
+
1. Update `AI_UI_COMPONENT_COVERAGE`.
|
|
81
|
+
2. Add or update the Zod schema for supported descriptors.
|
|
82
|
+
3. Add or update the renderer switch case.
|
|
83
|
+
4. Keep model-controlled URLs on safe relative/hash/HTTPS schemas.
|
|
84
|
+
5. Run the AI-UI coverage test.
|
|
85
|
+
6. Update docs and add a changeset before publishing.
|
|
86
|
+
|
|
87
|
+
## Build and test
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
cd src
|
|
91
|
+
pnpm -F @mihcm/ai-ui build
|
|
92
|
+
pnpm -F @mihcm/ai-ui typecheck
|
|
93
|
+
pnpm -F @mihcm/ai-ui test
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Related docs
|
|
97
|
+
|
|
98
|
+
- `src/apps/docs/app/ai-ui/page.mdx`
|
|
99
|
+
- `docs/security-playbook.md`
|
|
100
|
+
- `docs/CONVENTIONS.md`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ALLOWED_COMPONENTS, type AllowedComponent } from './schemas/index.js';
|
|
2
|
+
export declare const UI_COMPONENTS: readonly ["AccessLevelGroup", "Accordion", "Alert", "AlertDialog", "AspectRatio", "Avatar", "AvatarGroup", "Badge", "Banner", "BarList", "Breadcrumb", "Button", "Calendar", "Card", "Carousel", "CategoryBar", "Chart", "Checkbox", "CheckboxGrid", "Collapsible", "Combobox", "Command", "ContextMenu", "DataTable", "DatePicker", "Dialog", "Drawer", "DropdownMenu", "Dropzone", "EmptyState", "Form", "HoverCard", "IconSidebar", "Input", "InputOTP", "Label", "Link", "Logo", "MainSidebar", "Menubar", "NavigationMenu", "NotificationBadge", "PageShell", "Pagination", "Popover", "Popper", "Progress", "ProgressCircle", "RadioGroup", "RadioCardGroup", "Resizable", "RichTextEditor", "ScrollArea", "SearchField", "SectionHeader", "Select", "Separator", "Sheet", "Sidebar", "Skeleton", "Slider", "SortableList", "SparkChart", "StatCard", "StatusBadge", "Switch", "Table", "Tabs", "TabNavigation", "Tag", "Text", "Textarea", "TitleBar", "Toast", "Toggle", "Tooltip", "TopBar", "TransferList", "Tracker"];
|
|
3
|
+
export type UIComponentName = (typeof UI_COMPONENTS)[number];
|
|
4
|
+
export type AIUICoverageStatus = 'supported' | 'host-composed' | 'blocked';
|
|
5
|
+
export interface AIUIComponentCoverage {
|
|
6
|
+
component: UIComponentName;
|
|
7
|
+
status: AIUICoverageStatus;
|
|
8
|
+
schema?: string;
|
|
9
|
+
reason: string;
|
|
10
|
+
}
|
|
11
|
+
type SupportedAIUIComponent = Exclude<AllowedComponent, 'Stack'>;
|
|
12
|
+
export declare const AI_UI_SUPPORTED_COMPONENTS: SupportedAIUIComponent[];
|
|
13
|
+
export declare const AI_UI_COMPONENT_COVERAGE: readonly AIUIComponentCoverage[];
|
|
14
|
+
export declare function isAIUISupportedComponent(component: string): component is (typeof ALLOWED_COMPONENTS)[number];
|
|
15
|
+
export declare function getAIUIComponentCoverage(component: string): AIUIComponentCoverage | undefined;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=coverage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE/E,eAAO,MAAM,aAAa,k+BAgFhB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,eAAe,GACf,SAAS,CAAC;AAEd,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,eAAe,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAEjE,eAAO,MAAM,0BAA0B,0BAED,CAAC;AAiOvC,eAAO,MAAM,wBAAwB,EAAE,SAAS,qBAAqB,EAWb,CAAC;AAEzD,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAChB,SAAS,IAAI,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAElD;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAChB,qBAAqB,GAAG,SAAS,CAEnC"}
|
package/dist/coverage.js
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { ALLOWED_COMPONENTS } from './schemas/index.js';
|
|
2
|
+
export const UI_COMPONENTS = [
|
|
3
|
+
'AccessLevelGroup',
|
|
4
|
+
'Accordion',
|
|
5
|
+
'Alert',
|
|
6
|
+
'AlertDialog',
|
|
7
|
+
'AspectRatio',
|
|
8
|
+
'Avatar',
|
|
9
|
+
'AvatarGroup',
|
|
10
|
+
'Badge',
|
|
11
|
+
'Banner',
|
|
12
|
+
'BarList',
|
|
13
|
+
'Breadcrumb',
|
|
14
|
+
'Button',
|
|
15
|
+
'Calendar',
|
|
16
|
+
'Card',
|
|
17
|
+
'Carousel',
|
|
18
|
+
'CategoryBar',
|
|
19
|
+
'Chart',
|
|
20
|
+
'Checkbox',
|
|
21
|
+
'CheckboxGrid',
|
|
22
|
+
'Collapsible',
|
|
23
|
+
'Combobox',
|
|
24
|
+
'Command',
|
|
25
|
+
'ContextMenu',
|
|
26
|
+
'DataTable',
|
|
27
|
+
'DatePicker',
|
|
28
|
+
'Dialog',
|
|
29
|
+
'Drawer',
|
|
30
|
+
'DropdownMenu',
|
|
31
|
+
'Dropzone',
|
|
32
|
+
'EmptyState',
|
|
33
|
+
'Form',
|
|
34
|
+
'HoverCard',
|
|
35
|
+
'IconSidebar',
|
|
36
|
+
'Input',
|
|
37
|
+
'InputOTP',
|
|
38
|
+
'Label',
|
|
39
|
+
'Link',
|
|
40
|
+
'Logo',
|
|
41
|
+
'MainSidebar',
|
|
42
|
+
'Menubar',
|
|
43
|
+
'NavigationMenu',
|
|
44
|
+
'NotificationBadge',
|
|
45
|
+
'PageShell',
|
|
46
|
+
'Pagination',
|
|
47
|
+
'Popover',
|
|
48
|
+
'Popper',
|
|
49
|
+
'Progress',
|
|
50
|
+
'ProgressCircle',
|
|
51
|
+
'RadioGroup',
|
|
52
|
+
'RadioCardGroup',
|
|
53
|
+
'Resizable',
|
|
54
|
+
'RichTextEditor',
|
|
55
|
+
'ScrollArea',
|
|
56
|
+
'SearchField',
|
|
57
|
+
'SectionHeader',
|
|
58
|
+
'Select',
|
|
59
|
+
'Separator',
|
|
60
|
+
'Sheet',
|
|
61
|
+
'Sidebar',
|
|
62
|
+
'Skeleton',
|
|
63
|
+
'Slider',
|
|
64
|
+
'SortableList',
|
|
65
|
+
'SparkChart',
|
|
66
|
+
'StatCard',
|
|
67
|
+
'StatusBadge',
|
|
68
|
+
'Switch',
|
|
69
|
+
'Table',
|
|
70
|
+
'Tabs',
|
|
71
|
+
'TabNavigation',
|
|
72
|
+
'Tag',
|
|
73
|
+
'Text',
|
|
74
|
+
'Textarea',
|
|
75
|
+
'TitleBar',
|
|
76
|
+
'Toast',
|
|
77
|
+
'Toggle',
|
|
78
|
+
'Tooltip',
|
|
79
|
+
'TopBar',
|
|
80
|
+
'TransferList',
|
|
81
|
+
'Tracker',
|
|
82
|
+
];
|
|
83
|
+
export const AI_UI_SUPPORTED_COMPONENTS = ALLOWED_COMPONENTS.filter((component) => component !== 'Stack');
|
|
84
|
+
const supportedReasons = {
|
|
85
|
+
Accordion: 'Bounded item array; content is plain text; host owns state.',
|
|
86
|
+
Alert: 'Plain text feedback only; variant enum is constrained.',
|
|
87
|
+
AlertDialog: 'Host owns open state; action labels are plain text and no handler body is accepted.',
|
|
88
|
+
Avatar: 'Image URL, fallback, size, and status are Zod constrained.',
|
|
89
|
+
AvatarGroup: 'Bounded avatar array with URL/fallback-only entries.',
|
|
90
|
+
Badge: 'Short text label with constrained variants.',
|
|
91
|
+
Banner: 'Plain text message with constrained tone and dismissibility.',
|
|
92
|
+
Breadcrumb: 'Flat bounded label/href list; no arbitrary children.',
|
|
93
|
+
Button: 'Text-only semantic button; action is an id resolved by the host action map and web type defaults to button.',
|
|
94
|
+
Card: 'Plain title, description, and body; no arbitrary nested React nodes.',
|
|
95
|
+
Checkbox: 'Host owns state; descriptor provides label and initial state only.',
|
|
96
|
+
Dialog: 'Host owns open state; body is plain text.',
|
|
97
|
+
DropdownMenu: 'Flat menu items only; no arbitrary submenus or handler code.',
|
|
98
|
+
EmptyState: 'Text-only empty state; action is host-resolved by id.',
|
|
99
|
+
Input: 'Host owns value/change; safe input types only.',
|
|
100
|
+
Label: 'Plain text label with constrained tone and association token.',
|
|
101
|
+
Link: 'Semantic anchor with bounded label, href, variant, and external marker props; host should allowlist hrefs.',
|
|
102
|
+
Pagination: 'Numeric page data only; renderer computes links.',
|
|
103
|
+
Progress: 'Numeric value and constrained presentation props only.',
|
|
104
|
+
RadioGroup: 'Bounded option array; host owns state.',
|
|
105
|
+
SectionHeader: 'Text-only header; action slot is intentionally omitted.',
|
|
106
|
+
Select: 'Bounded option array; host owns value/change.',
|
|
107
|
+
Separator: 'Orientation enum only.',
|
|
108
|
+
Sheet: 'Host owns open state; title/description/side/size only.',
|
|
109
|
+
StatCard: 'Text metric and constrained tone only.',
|
|
110
|
+
StatusBadge: 'Short text label with constrained tone; icon slot omitted.',
|
|
111
|
+
Switch: 'Host owns state; descriptor provides label and initial state only.',
|
|
112
|
+
Table: 'Bounded columns/rows with string cell values only.',
|
|
113
|
+
Tabs: 'Bounded tab array with plain text content.',
|
|
114
|
+
Tag: 'Short label with constrained variant/size/removable state.',
|
|
115
|
+
Text: 'Plain text with constrained typography props and safe semantic text tags.',
|
|
116
|
+
Textarea: 'Host owns value/change; descriptor cannot provide form data.',
|
|
117
|
+
TitleBar: 'Text-only title/supertitle; icon and action slots omitted.',
|
|
118
|
+
Toggle: 'Host owns pressed state; descriptor provides label and initial state only.',
|
|
119
|
+
};
|
|
120
|
+
const deferredComponents = {
|
|
121
|
+
AccessLevelGroup: {
|
|
122
|
+
status: 'host-composed',
|
|
123
|
+
reason: 'Authorization semantics must be bound to product policy and host data, not model output.',
|
|
124
|
+
},
|
|
125
|
+
AspectRatio: {
|
|
126
|
+
status: 'host-composed',
|
|
127
|
+
reason: 'Layout-only primitive; host should wrap trusted media/content descriptors.',
|
|
128
|
+
},
|
|
129
|
+
BarList: {
|
|
130
|
+
status: 'host-composed',
|
|
131
|
+
reason: 'Ranked metrics, links, and value formatting must be supplied by trusted host data.',
|
|
132
|
+
},
|
|
133
|
+
Calendar: {
|
|
134
|
+
status: 'host-composed',
|
|
135
|
+
reason: 'Date selection, locale, disabled rules, and range policy need host-owned business rules.',
|
|
136
|
+
},
|
|
137
|
+
Carousel: {
|
|
138
|
+
status: 'host-composed',
|
|
139
|
+
reason: 'Requires trusted slide content and motion policy; model output should not define arbitrary slide trees.',
|
|
140
|
+
},
|
|
141
|
+
CategoryBar: {
|
|
142
|
+
status: 'host-composed',
|
|
143
|
+
reason: 'Segment values and labels are host analytics data and need host-owned color semantics.',
|
|
144
|
+
},
|
|
145
|
+
Chart: {
|
|
146
|
+
status: 'host-composed',
|
|
147
|
+
reason: 'Chart data, series mapping, and formatter functions must be host-supplied and audited.',
|
|
148
|
+
},
|
|
149
|
+
CheckboxGrid: {
|
|
150
|
+
status: 'host-composed',
|
|
151
|
+
reason: 'Bulk selection rules and option source are application data owned by the host.',
|
|
152
|
+
},
|
|
153
|
+
Collapsible: {
|
|
154
|
+
status: 'host-composed',
|
|
155
|
+
reason: 'Generic disclosure slots can contain arbitrary content; compose from safe child descriptors instead.',
|
|
156
|
+
},
|
|
157
|
+
Combobox: {
|
|
158
|
+
status: 'host-composed',
|
|
159
|
+
reason: 'Async search, option loading, and filtering must be host-owned.',
|
|
160
|
+
},
|
|
161
|
+
Command: {
|
|
162
|
+
status: 'host-composed',
|
|
163
|
+
reason: 'Command execution and shortcuts must come from a host allowlist.',
|
|
164
|
+
},
|
|
165
|
+
ContextMenu: {
|
|
166
|
+
status: 'host-composed',
|
|
167
|
+
reason: 'Context-sensitive actions must be host allowlisted and bound to trusted targets.',
|
|
168
|
+
},
|
|
169
|
+
DataTable: {
|
|
170
|
+
status: 'host-composed',
|
|
171
|
+
reason: 'Large data, custom renderers, filtering, and sorting policy must be host-owned.',
|
|
172
|
+
},
|
|
173
|
+
DatePicker: {
|
|
174
|
+
status: 'host-composed',
|
|
175
|
+
reason: 'Date parsing, time zones, disabled dates, and submit wiring require host policy.',
|
|
176
|
+
},
|
|
177
|
+
Drawer: {
|
|
178
|
+
status: 'host-composed',
|
|
179
|
+
reason: 'Slot-based overlay; use Sheet descriptor for bounded AI-generated drawer-like output.',
|
|
180
|
+
},
|
|
181
|
+
Dropzone: {
|
|
182
|
+
status: 'blocked',
|
|
183
|
+
reason: 'File selection handles user files and validation policy; model output must not request uploads.',
|
|
184
|
+
},
|
|
185
|
+
Form: {
|
|
186
|
+
status: 'blocked',
|
|
187
|
+
reason: 'Model-defined forms can collect sensitive data; hosts must compose explicit validated fields.',
|
|
188
|
+
},
|
|
189
|
+
HoverCard: {
|
|
190
|
+
status: 'host-composed',
|
|
191
|
+
reason: 'Overlay timing/content slots should wrap safe descriptors chosen by the host.',
|
|
192
|
+
},
|
|
193
|
+
IconSidebar: {
|
|
194
|
+
status: 'host-composed',
|
|
195
|
+
reason: 'Navigation destinations and icons must be host-owned.',
|
|
196
|
+
},
|
|
197
|
+
InputOTP: {
|
|
198
|
+
status: 'blocked',
|
|
199
|
+
reason: 'OTP fields handle authentication secrets and must never be model-generated.',
|
|
200
|
+
},
|
|
201
|
+
Logo: {
|
|
202
|
+
status: 'host-composed',
|
|
203
|
+
reason: 'Brand usage must follow approved asset policy and host-selected brand variants.',
|
|
204
|
+
},
|
|
205
|
+
MainSidebar: {
|
|
206
|
+
status: 'host-composed',
|
|
207
|
+
reason: 'Navigation structure and destinations must be host-owned.',
|
|
208
|
+
},
|
|
209
|
+
Menubar: {
|
|
210
|
+
status: 'host-composed',
|
|
211
|
+
reason: 'Nested menu actions and shortcuts must be host allowlisted.',
|
|
212
|
+
},
|
|
213
|
+
NavigationMenu: {
|
|
214
|
+
status: 'host-composed',
|
|
215
|
+
reason: 'Product navigation, links, and mega-menu content must be host-owned.',
|
|
216
|
+
},
|
|
217
|
+
NotificationBadge: {
|
|
218
|
+
status: 'host-composed',
|
|
219
|
+
reason: 'Decorative count badge needs parent context and host-owned notification data.',
|
|
220
|
+
},
|
|
221
|
+
PageShell: {
|
|
222
|
+
status: 'host-composed',
|
|
223
|
+
reason: 'Application shell slots are structural and must be assembled by the host.',
|
|
224
|
+
},
|
|
225
|
+
Popover: {
|
|
226
|
+
status: 'host-composed',
|
|
227
|
+
reason: 'Generic overlay slots can contain arbitrary content; host should render safe descriptors inside.',
|
|
228
|
+
},
|
|
229
|
+
Popper: {
|
|
230
|
+
status: 'host-composed',
|
|
231
|
+
reason: 'Positioning primitive; content and trigger semantics must be host-owned.',
|
|
232
|
+
},
|
|
233
|
+
ProgressCircle: {
|
|
234
|
+
status: 'host-composed',
|
|
235
|
+
reason: 'KPI values and thresholds must be host-owned; use Progress descriptor for simple bounded bars.',
|
|
236
|
+
},
|
|
237
|
+
RadioCardGroup: {
|
|
238
|
+
status: 'host-composed',
|
|
239
|
+
reason: 'Card option content can contain rich product-specific details; host should define options.',
|
|
240
|
+
},
|
|
241
|
+
Resizable: {
|
|
242
|
+
status: 'host-composed',
|
|
243
|
+
reason: 'Panel layout state and resize constraints must be host-owned.',
|
|
244
|
+
},
|
|
245
|
+
RichTextEditor: {
|
|
246
|
+
status: 'blocked',
|
|
247
|
+
reason: 'Rich text can carry unsafe markup and user content; keep host-controlled and sanitized.',
|
|
248
|
+
},
|
|
249
|
+
ScrollArea: {
|
|
250
|
+
status: 'host-composed',
|
|
251
|
+
reason: 'Layout utility; host should wrap safe descriptor output.',
|
|
252
|
+
},
|
|
253
|
+
SearchField: {
|
|
254
|
+
status: 'host-composed',
|
|
255
|
+
reason: 'Search query state, async results, and telemetry must be host-owned.',
|
|
256
|
+
},
|
|
257
|
+
Sidebar: {
|
|
258
|
+
status: 'host-composed',
|
|
259
|
+
reason: 'Low-level shell/navigation primitive with application-owned state and links.',
|
|
260
|
+
},
|
|
261
|
+
Skeleton: {
|
|
262
|
+
status: 'host-composed',
|
|
263
|
+
reason: 'Loading placeholders should reflect host data-fetching state.',
|
|
264
|
+
},
|
|
265
|
+
Slider: {
|
|
266
|
+
status: 'host-composed',
|
|
267
|
+
reason: 'Numeric range state and commit behavior must be host-owned.',
|
|
268
|
+
},
|
|
269
|
+
SortableList: {
|
|
270
|
+
status: 'host-composed',
|
|
271
|
+
reason: 'Drag ordering changes application state; host must own item identity and persistence.',
|
|
272
|
+
},
|
|
273
|
+
SparkChart: {
|
|
274
|
+
status: 'host-composed',
|
|
275
|
+
reason: 'Chart values and scale decisions must come from trusted host analytics data.',
|
|
276
|
+
},
|
|
277
|
+
TabNavigation: {
|
|
278
|
+
status: 'host-composed',
|
|
279
|
+
reason: 'Navigation targets and routing state must be host-owned.',
|
|
280
|
+
},
|
|
281
|
+
Toast: {
|
|
282
|
+
status: 'host-composed',
|
|
283
|
+
reason: 'Notification lifecycle and deduplication must be host-owned.',
|
|
284
|
+
},
|
|
285
|
+
Tooltip: {
|
|
286
|
+
status: 'host-composed',
|
|
287
|
+
reason: 'Tooltip trigger/content pairing belongs to the host component tree.',
|
|
288
|
+
},
|
|
289
|
+
TopBar: {
|
|
290
|
+
status: 'host-composed',
|
|
291
|
+
reason: 'Authenticated user, navigation, and utility actions must be host-owned.',
|
|
292
|
+
},
|
|
293
|
+
TransferList: {
|
|
294
|
+
status: 'host-composed',
|
|
295
|
+
reason: 'Bulk assignment semantics and source/target data must be host-owned.',
|
|
296
|
+
},
|
|
297
|
+
Tracker: {
|
|
298
|
+
status: 'host-composed',
|
|
299
|
+
reason: 'Status timelines represent host data and should not be generated as arbitrary model state.',
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
export const AI_UI_COMPONENT_COVERAGE = [
|
|
303
|
+
...AI_UI_SUPPORTED_COMPONENTS.map((component) => ({
|
|
304
|
+
component,
|
|
305
|
+
status: 'supported',
|
|
306
|
+
schema: `${component}Descriptor`,
|
|
307
|
+
reason: supportedReasons[component],
|
|
308
|
+
})),
|
|
309
|
+
...Object.entries(deferredComponents).map(([component, entry]) => ({
|
|
310
|
+
component: component,
|
|
311
|
+
...entry,
|
|
312
|
+
})),
|
|
313
|
+
].sort((a, b) => a.component.localeCompare(b.component));
|
|
314
|
+
export function isAIUISupportedComponent(component) {
|
|
315
|
+
return ALLOWED_COMPONENTS.includes(component);
|
|
316
|
+
}
|
|
317
|
+
export function getAIUIComponentCoverage(component) {
|
|
318
|
+
return AI_UI_COMPONENT_COVERAGE.find((entry) => entry.component === component);
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=coverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage.js","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAyB,MAAM,oBAAoB,CAAC;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,kBAAkB;IAClB,WAAW;IACX,OAAO;IACP,aAAa;IACb,aAAa;IACb,QAAQ;IACR,aAAa;IACb,OAAO;IACP,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,QAAQ;IACR,UAAU;IACV,MAAM;IACN,UAAU;IACV,aAAa;IACb,OAAO;IACP,UAAU;IACV,cAAc;IACd,aAAa;IACb,UAAU;IACV,SAAS;IACT,aAAa;IACb,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,UAAU;IACV,YAAY;IACZ,MAAM;IACN,WAAW;IACX,aAAa;IACb,OAAO;IACP,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,aAAa;IACb,SAAS;IACT,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;IAC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AAoB;QAC5B,MAAM,EAAE,GAAG,SAAS,YAAY;QAChC,MAAM,EAAE,gBAAgB,CAAC,SAAS,CAAC;KACpC,CAAC,CAAC;IACH,GAAG,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACjE,SAAS,EAAE,SAA4B;QACvC,GAAG,KAAK;KACT,CAAC,CAAC;CACJ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAEzD,MAAM,UAAU,wBAAwB,CACtC,SAAiB;IAEjB,OAAQ,kBAAwC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,SAAiB;IAEjB,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;AACjF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { renderDescriptor, AIUIRenderError } from './renderer.js';
|
|
2
|
+
export * from './schemas/index.js';
|
|
3
|
+
export { AI_UI_COMPONENT_COVERAGE, AI_UI_SUPPORTED_COMPONENTS, UI_COMPONENTS, getAIUIComponentCoverage, isAIUISupportedComponent, type AIUIComponentCoverage, type AIUICoverageStatus, type UIComponentName, } from './coverage.js';
|
|
4
|
+
export { renderUITool, renderUIToolDescription, renderUIToolSchema } from './tools.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAClE,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,aAAa,EACb,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { renderDescriptor, AIUIRenderError } from './renderer.js';
|
|
2
|
+
export * from './schemas/index.js';
|
|
3
|
+
export { AI_UI_COMPONENT_COVERAGE, AI_UI_SUPPORTED_COMPONENTS, UI_COMPONENTS, getAIUIComponentCoverage, isAIUISupportedComponent, } from './coverage.js';
|
|
4
|
+
export { renderUITool, renderUIToolDescription, renderUIToolSchema } from './tools.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAClE,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,aAAa,EACb,wBAAwB,EACxB,wBAAwB,GAIzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-UI renderer — validates a model-produced descriptor and renders it as
|
|
3
|
+
* @mihcm/ui. Same renderer works in React, Next.js, and React Native
|
|
4
|
+
* because the underlying primitives are universal.
|
|
5
|
+
*
|
|
6
|
+
* Security contract:
|
|
7
|
+
* - Every descriptor is parsed by `componentDescriptorSchema` (AI-UI-01).
|
|
8
|
+
* - Component names must appear in `ALLOWED_COMPONENTS` (AI-UI-02).
|
|
9
|
+
* - No dynamic code evaluation, no raw HTML, ever (AI-UI-03/04/05).
|
|
10
|
+
* - Action handlers are looked up by id from a server-supplied map — we
|
|
11
|
+
* never accept arbitrary URLs or function bodies.
|
|
12
|
+
*
|
|
13
|
+
* Wiki: docs/components/<each>.md
|
|
14
|
+
*/
|
|
15
|
+
import { type ReactElement } from 'react';
|
|
16
|
+
export declare class AIUIRenderError extends Error {
|
|
17
|
+
name: string;
|
|
18
|
+
readonly details?: unknown;
|
|
19
|
+
constructor(message: string, details?: unknown);
|
|
20
|
+
}
|
|
21
|
+
interface RenderOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Map of action ids → safe handlers. The model can only reference handlers
|
|
24
|
+
* by id; it never gets to define them.
|
|
25
|
+
*/
|
|
26
|
+
actions?: Record<string, () => void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render a model-supplied descriptor (already JSON-parsed) into React nodes.
|
|
30
|
+
*
|
|
31
|
+
* Throws `AIUIRenderError` if validation fails. Callers should render an
|
|
32
|
+
* "I couldn't render that" fallback rather than propagating the error to UI.
|
|
33
|
+
*/
|
|
34
|
+
export declare function renderDescriptor(raw: unknown, options?: RenderOptions): ReactElement;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAsB,KAAK,YAAY,EAAkB,MAAM,OAAO,CAAC;AAyH9E,qBAAa,eAAgB,SAAQ,KAAK;IAC/B,IAAI,SAAqB;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAI/C;AAED,UAAU,aAAa;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;CACtC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,EACZ,OAAO,GAAE,aAAkB,GAC1B,YAAY,CASd"}
|