@assemblyline-agents/openui 3.0.0
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/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/CORMORANT-GARAMOND-OFL.txt +93 -0
- package/dist/OUTFIT-OFL.txt +93 -0
- package/dist/artifact.d.ts +31 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +79 -0
- package/dist/artifact.js.map +1 -0
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +203 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/library.d.ts +9 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +109 -0
- package/dist/library.js.map +1 -0
- package/dist/openui-browser.js +629 -0
- package/dist/openui-styles.css +1 -0
- package/dist/render.d.ts +3 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +229 -0
- package/dist/render.js.map +1 -0
- package/dist/report-library.d.ts +2 -0
- package/dist/report-library.d.ts.map +1 -0
- package/dist/report-library.js +224 -0
- package/dist/report-library.js.map +1 -0
- package/dist/responsive-stack.d.ts +35 -0
- package/dist/responsive-stack.d.ts.map +1 -0
- package/dist/responsive-stack.js +58 -0
- package/dist/responsive-stack.js.map +1 -0
- package/dist/standard-pack.d.ts +4 -0
- package/dist/standard-pack.d.ts.map +1 -0
- package/dist/standard-pack.js +10 -0
- package/dist/standard-pack.js.map +1 -0
- package/dist/tools.d.ts +33 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +350 -0
- package/dist/tools.js.map +1 -0
- package/package.json +60 -0
- package/skills/openui-artifacts/SKILL.md +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Assembly Line contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @assemblyline-agents/openui
|
|
2
|
+
|
|
3
|
+
Reusable Assembly Line lifecycle tools backed by the official OpenUI runtime.
|
|
4
|
+
|
|
5
|
+
The default component pack is the complete 54-component \`@openuidev/react-ui\` standard library. Developers can allow every component, restrict it by name, or register an independently versioned component pack. The model supplies only OpenUI Lang and a title. It never supplies publication HTML, CSS, or JavaScript.
|
|
6
|
+
|
|
7
|
+
## Add the pack
|
|
8
|
+
|
|
9
|
+
\`\`\`sh
|
|
10
|
+
assembly-line add openui agent
|
|
11
|
+
\`\`\`
|
|
12
|
+
|
|
13
|
+
This creates \`tool-config/openui.ts\`, three tool wrappers, and the OpenUI operating skill. Configure \`R2_PUBLIC_BASE_URL\` or \`S3_PUBLIC_BASE_URL\` with an HTTPS origin before publishing.
|
|
14
|
+
|
|
15
|
+
The generated configuration uses the official standard pack with every component enabled. Restrict and theme it explicitly when needed:
|
|
16
|
+
|
|
17
|
+
\`\`\`ts
|
|
18
|
+
import { defineOpenUiConfig } from "@assemblyline-agents/openui";
|
|
19
|
+
|
|
20
|
+
export default defineOpenUiConfig({
|
|
21
|
+
allowedComponents: ["Stack", "Card", "CardHeader", "TextContent", "Table", "Col"],
|
|
22
|
+
brand: {
|
|
23
|
+
name: "Example",
|
|
24
|
+
theme: {
|
|
25
|
+
background: "#F7F7F5",
|
|
26
|
+
textBrand: "#1F2937",
|
|
27
|
+
fontHeading: "Georgia, serif",
|
|
28
|
+
fontBody: "Arial, sans-serif"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
\`\`\`
|
|
33
|
+
|
|
34
|
+
The tool's \`document\` schema is generated from the selected pack and allowlist, so agents see the permitted component signatures rather than a framework-owned report vocabulary. Artifact titles are lifecycle metadata and do not force a particular root component.
|
|
35
|
+
|
|
36
|
+
The standard renderer keeps desktop row compositions intact and automatically wraps row \`Stack\` layouts on narrow screens. Metric cards and callouts use a readable minimum width, yielding two columns when the container can support them and one column when it cannot. The document itself cannot scroll sideways; wide tables and Cartesian charts retain component-local scrolling, while pie, radial, and radar compositions wrap within the viewport. Mobile table text stays at the reviewed size instead of being enlarged by browser text autosizing.
|
|
37
|
+
|
|
38
|
+
## Component packs
|
|
39
|
+
|
|
40
|
+
A component pack combines an OpenUI library, an immutable identity and version, and trusted publication code:
|
|
41
|
+
|
|
42
|
+
\`\`\`ts
|
|
43
|
+
import {
|
|
44
|
+
createOpenUiLibrary,
|
|
45
|
+
defineOpenUiConfig,
|
|
46
|
+
type OpenUiComponentPack
|
|
47
|
+
} from "@assemblyline-agents/openui";
|
|
48
|
+
|
|
49
|
+
const pack: OpenUiComponentPack = {
|
|
50
|
+
id: "@example/product-ui",
|
|
51
|
+
version: "3.1.0",
|
|
52
|
+
library: createOpenUiLibrary({
|
|
53
|
+
root: "ProductPage",
|
|
54
|
+
components: [ProductPage, Metric, Chart]
|
|
55
|
+
}),
|
|
56
|
+
render({ source, title, config }) {
|
|
57
|
+
return renderReviewedProductUi({ source, title, theme: config.brand.theme });
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default defineOpenUiConfig({ componentPack: pack });
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
Pack renderers execute as trusted application code. Review and version them like any other plugin. Project content may select installed packs, but it must not load arbitrary repository code into the runtime.
|
|
65
|
+
|
|
66
|
+
## Lifecycle and security
|
|
67
|
+
|
|
68
|
+
\`openui_create\` and \`openui_update\` store private immutable revisions with the exact pack version, allowlist, theme, and provenance. \`openui_publish\` renders the selected revision without an approval pause, verifies the bytes served by storage, and selects that exact HTTPS URL for runtime delivery. Its model-facing result omits the URL, so the channel does not depend on the model copying a link.
|
|
69
|
+
|
|
70
|
+
The official renderer embeds OpenUI's reviewed browser runtime and styles in a network-disabled CSP. Agent content cannot add scripts, styles, external requests, queries, or mutations. Local OpenUI state and actions are disabled by default and can be enabled by the developer. Tightening the current allowlist or interactivity policy also blocks publication of older revisions that exceed it.
|
|
71
|
+
|
|
72
|
+
Published links are unlisted bearer links. Use the built-in \`deliver_artifact\` tool instead when the artifact must remain a private channel file.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2015 the Cormorant Project Authors (github.com/CatharsisFonts/Cormorant)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2021 The Outfit Project Authors (https://github.com/Outfitio/Outfit-Fonts)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { OpenUiConfigSnapshot } from "./config.js";
|
|
2
|
+
import type { ParsedOpenUiDocument } from "./library.js";
|
|
3
|
+
export interface OpenUiArtifactRevision {
|
|
4
|
+
schemaVersion: 2;
|
|
5
|
+
kind: "openui";
|
|
6
|
+
artifactId: string;
|
|
7
|
+
revision: string;
|
|
8
|
+
parentRevision?: string;
|
|
9
|
+
source: string;
|
|
10
|
+
title: string;
|
|
11
|
+
config: OpenUiConfigSnapshot;
|
|
12
|
+
provenance: {
|
|
13
|
+
runId: string;
|
|
14
|
+
agentRevision: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function createArtifactRevision(input: {
|
|
18
|
+
document: ParsedOpenUiDocument;
|
|
19
|
+
title: string;
|
|
20
|
+
config: OpenUiConfigSnapshot;
|
|
21
|
+
runId: string;
|
|
22
|
+
agentRevision: string;
|
|
23
|
+
artifactId?: string;
|
|
24
|
+
parentRevision?: string;
|
|
25
|
+
}): OpenUiArtifactRevision;
|
|
26
|
+
export declare function artifactRevisionKey(artifactId: string, revision: string): string;
|
|
27
|
+
export declare function artifactPublicationKey(record: OpenUiArtifactRevision): string;
|
|
28
|
+
export declare function parseArtifactRevision(bytes: Uint8Array): OpenUiArtifactRevision;
|
|
29
|
+
export declare function validArtifactId(value: unknown): value is string;
|
|
30
|
+
export declare function validRevision(value: unknown): value is string;
|
|
31
|
+
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../src/artifact.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,oBAAoB,CAAC;IAC7B,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,oBAAoB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,sBAAsB,CA2BzB;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAW7E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,sBAAsB,CA2B/E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE/D;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE7D"}
|
package/dist/artifact.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export function createArtifactRevision(input) {
|
|
3
|
+
const revision = sha256(JSON.stringify({
|
|
4
|
+
schemaVersion: 2,
|
|
5
|
+
source: input.document.source,
|
|
6
|
+
title: input.title,
|
|
7
|
+
config: input.config,
|
|
8
|
+
parentRevision: input.parentRevision ?? null,
|
|
9
|
+
provenance: {
|
|
10
|
+
runId: input.runId,
|
|
11
|
+
agentRevision: input.agentRevision
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
const artifactId = input.artifactId ?? "oui_" + sha256(input.runId + ":" + revision).slice(0, 24);
|
|
15
|
+
return {
|
|
16
|
+
schemaVersion: 2,
|
|
17
|
+
kind: "openui",
|
|
18
|
+
artifactId,
|
|
19
|
+
revision,
|
|
20
|
+
...(input.parentRevision ? { parentRevision: input.parentRevision } : {}),
|
|
21
|
+
source: input.document.source,
|
|
22
|
+
title: input.title,
|
|
23
|
+
config: input.config,
|
|
24
|
+
provenance: {
|
|
25
|
+
runId: input.runId,
|
|
26
|
+
agentRevision: input.agentRevision
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function artifactRevisionKey(artifactId, revision) {
|
|
31
|
+
return "artifacts/openui/" + artifactId + "/revisions/" + revision + ".json";
|
|
32
|
+
}
|
|
33
|
+
export function artifactPublicationKey(record) {
|
|
34
|
+
const token = sha256(record.artifactId + ":" + record.revision + ":" + record.provenance.runId).slice(0, 32);
|
|
35
|
+
return "artifacts/openui/"
|
|
36
|
+
+ record.artifactId
|
|
37
|
+
+ "/publications/"
|
|
38
|
+
+ record.revision
|
|
39
|
+
+ "/"
|
|
40
|
+
+ token
|
|
41
|
+
+ "/index.html";
|
|
42
|
+
}
|
|
43
|
+
export function parseArtifactRevision(bytes) {
|
|
44
|
+
let value;
|
|
45
|
+
try {
|
|
46
|
+
value = JSON.parse(Buffer.from(bytes).toString("utf8"));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new Error("Stored OpenUI artifact revision is not valid JSON.");
|
|
50
|
+
}
|
|
51
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
52
|
+
throw new Error("Stored OpenUI artifact revision is invalid.");
|
|
53
|
+
}
|
|
54
|
+
const record = value;
|
|
55
|
+
if (record.schemaVersion !== 2
|
|
56
|
+
|| record.kind !== "openui"
|
|
57
|
+
|| !validArtifactId(record.artifactId)
|
|
58
|
+
|| !validRevision(record.revision)
|
|
59
|
+
|| (record.parentRevision !== undefined && !validRevision(record.parentRevision))
|
|
60
|
+
|| typeof record.source !== "string"
|
|
61
|
+
|| typeof record.title !== "string"
|
|
62
|
+
|| !record.config
|
|
63
|
+
|| !record.provenance
|
|
64
|
+
|| typeof record.provenance.runId !== "string"
|
|
65
|
+
|| typeof record.provenance.agentRevision !== "string") {
|
|
66
|
+
throw new Error("Stored OpenUI artifact revision has an invalid shape.");
|
|
67
|
+
}
|
|
68
|
+
return record;
|
|
69
|
+
}
|
|
70
|
+
export function validArtifactId(value) {
|
|
71
|
+
return typeof value === "string" && /^oui_[a-f0-9]{24}$/u.test(value);
|
|
72
|
+
}
|
|
73
|
+
export function validRevision(value) {
|
|
74
|
+
return typeof value === "string" && /^[a-f0-9]{64}$/u.test(value);
|
|
75
|
+
}
|
|
76
|
+
function sha256(value) {
|
|
77
|
+
return createHash("sha256").update(value).digest("hex");
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../src/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAmBzC,MAAM,UAAU,sBAAsB,CAAC,KAQtC;IACC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;QACrC,aAAa,EAAE,CAAC;QAChB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM;QAC7B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,IAAI;QAC5C,UAAU,EAAE;YACV,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC;KACF,CAAC,CAAC,CAAC;IACJ,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClG,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,IAAI,EAAE,QAAQ;QACd,UAAU;QACV,QAAQ;QACR,GAAG,CAAC,KAAK,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
|
1
|
+
import { type Library } from "@openuidev/lang-core";
|
|
2
|
+
import type { Theme } from "@openuidev/react-ui";
|
|
3
|
+
export interface OpenUiBrandProfile {
|
|
4
|
+
name: string;
|
|
5
|
+
legalName?: string;
|
|
6
|
+
theme: Theme;
|
|
7
|
+
logo?: {
|
|
8
|
+
dataUri: string;
|
|
9
|
+
alt: string;
|
|
10
|
+
};
|
|
11
|
+
footer?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface OpenUiComponentPackDescriptor {
|
|
14
|
+
id: string;
|
|
15
|
+
version: string;
|
|
16
|
+
root: string;
|
|
17
|
+
}
|
|
18
|
+
export interface OpenUiConfigSnapshot {
|
|
19
|
+
componentPack: OpenUiComponentPackDescriptor;
|
|
20
|
+
brand: OpenUiBrandProfile;
|
|
21
|
+
allowedComponents: string[];
|
|
22
|
+
allowLocalInteractivity: boolean;
|
|
23
|
+
maxDocumentChars: number;
|
|
24
|
+
}
|
|
25
|
+
export interface OpenUiRenderInput {
|
|
26
|
+
source: string;
|
|
27
|
+
title: string;
|
|
28
|
+
config: OpenUiConfigSnapshot;
|
|
29
|
+
}
|
|
30
|
+
export interface OpenUiComponentPack {
|
|
31
|
+
id: string;
|
|
32
|
+
version: string;
|
|
33
|
+
library: Library<unknown>;
|
|
34
|
+
render(input: OpenUiRenderInput): string;
|
|
35
|
+
}
|
|
36
|
+
export interface OpenUiConfig {
|
|
37
|
+
componentPack: OpenUiComponentPack;
|
|
38
|
+
library: Library<unknown>;
|
|
39
|
+
brand: OpenUiBrandProfile;
|
|
40
|
+
allowedComponents: string[];
|
|
41
|
+
allowLocalInteractivity: boolean;
|
|
42
|
+
maxDocumentChars: number;
|
|
43
|
+
}
|
|
44
|
+
export interface OpenUiConfigInput {
|
|
45
|
+
componentPack?: OpenUiComponentPack;
|
|
46
|
+
brand?: {
|
|
47
|
+
name?: string;
|
|
48
|
+
legalName?: string;
|
|
49
|
+
theme?: Theme;
|
|
50
|
+
logo?: OpenUiBrandProfile["logo"];
|
|
51
|
+
footer?: string;
|
|
52
|
+
};
|
|
53
|
+
allowedComponents?: string[];
|
|
54
|
+
allowLocalInteractivity?: boolean;
|
|
55
|
+
maxDocumentChars?: number;
|
|
56
|
+
}
|
|
57
|
+
export declare function defineOpenUiConfig(input?: OpenUiConfigInput | OpenUiConfig): OpenUiConfig;
|
|
58
|
+
export declare function snapshotOpenUiConfig(config: OpenUiConfig): OpenUiConfigSnapshot;
|
|
59
|
+
export declare function hydrateOpenUiConfig(snapshot: OpenUiConfigSnapshot, componentPack: OpenUiComponentPack): OpenUiConfig;
|
|
60
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,6BAA6B;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,6BAA6B,CAAC;IAC7C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,uBAAuB,EAAE,OAAO,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,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