@ai-gui/plugin-artifact 0.4.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +68 -0
- package/dist/index.cjs +1027 -0
- package/dist/index.d.cts +103 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +1010 -0
- package/package.json +60 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @ai-gui/plugin-artifact
|
|
2
|
+
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add plugin authoring helpers, secure source citation blocks, revisioned artifacts, bounded declarative AI-generated UI trees, molecular structures, and interactive maps.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @ai-gui/core@0.4.0
|
|
13
|
+
|
|
14
|
+
## 0.3.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- Add strict artifact create/update commands, an immutable revisioned store with operation receipts and snapshots, commit-time plugin processing, dynamic prompt guidance, and a safe native DOM artifact workspace.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Liang Li
|
|
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,68 @@
|
|
|
1
|
+
# @ai-gui/plugin-artifact
|
|
2
|
+
|
|
3
|
+
Secure, framework-neutral artifact commands and a native DOM workspace for AIGUI.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @ai-gui/core @ai-gui/plugin-artifact
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { ArtifactStore, artifact } from "@ai-gui/plugin-artifact"
|
|
15
|
+
|
|
16
|
+
const store = new ArtifactStore()
|
|
17
|
+
const plugins = [artifact({ store })]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The model may create or fully replace artifact content through closed JSON fences. Mutations are applied synchronously in `onASTCommit`, before adapter patches are dispatched.
|
|
21
|
+
|
|
22
|
+
````markdown
|
|
23
|
+
```artifact-create
|
|
24
|
+
{
|
|
25
|
+
"version": 1,
|
|
26
|
+
"operationId": "create-readme-1",
|
|
27
|
+
"artifact": {
|
|
28
|
+
"id": "readme",
|
|
29
|
+
"title": "Read me",
|
|
30
|
+
"filename": "README.md",
|
|
31
|
+
"kind": "markdown",
|
|
32
|
+
"content": "# Hello"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```artifact-update
|
|
38
|
+
{
|
|
39
|
+
"version": 1,
|
|
40
|
+
"operationId": "update-readme-1",
|
|
41
|
+
"id": "readme",
|
|
42
|
+
"baseRevision": 0,
|
|
43
|
+
"content": "# Updated"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
````
|
|
47
|
+
|
|
48
|
+
## Security
|
|
49
|
+
|
|
50
|
+
- Strict JSON with unknown-key and dangerous-key rejection.
|
|
51
|
+
- Safe bounded IDs, operation IDs, titles, filenames, languages, artifact count, per-artifact bytes, and total bytes.
|
|
52
|
+
- Exact revision conflicts and canonical operation-receipt idempotency.
|
|
53
|
+
- Immutable frozen records and atomically validated snapshots.
|
|
54
|
+
- No model delete command, actions, components, network requests, filesystem access, or code execution.
|
|
55
|
+
- Text and code use `textContent`; Markdown uses a small inert DOM renderer with HTTPS-only links; JSON preview is bounded.
|
|
56
|
+
- Invalid command UI is generic and never reflects model input or detailed parser issues.
|
|
57
|
+
- The module is safe to import without browser globals. DOM is accessed only when mounting a workspace.
|
|
58
|
+
|
|
59
|
+
## Exports
|
|
60
|
+
|
|
61
|
+
- `ArtifactStore`
|
|
62
|
+
- `artifact(options?)`
|
|
63
|
+
- `artifactPromptSpec(store?)`
|
|
64
|
+
- `parseArtifactCreate(source)` and `parseArtifactUpdate(source)`
|
|
65
|
+
- `serializeArtifactCreate(command)` and `serializeArtifactUpdate(command)`
|
|
66
|
+
- `mountArtifactWorkspace(host, store)`
|
|
67
|
+
- `artifactCss`
|
|
68
|
+
- Artifact commands, records, receipts, snapshots, options, results, listener types, and errors
|