@simmalugnt-se/payload-editor-assistant 0.12.1 → 0.13.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 +30 -0
- package/README.md +37 -0
- package/dist/chat-images.d.ts +20 -0
- package/dist/chat-images.js +61 -0
- package/dist/components/ChatImages.d.ts +20 -0
- package/dist/components/ChatImages.js +113 -0
- package/dist/components/EditorAssistantAside.d.ts +1 -1
- package/dist/components/EditorAssistantAside.js +31 -17
- package/dist/components/EditorAssistantDocumentBridge.js +1 -1
- package/dist/components/ProposalReview.d.ts +1 -1
- package/dist/components/ProposalReview.js +7 -3
- package/dist/components/assistant-context.d.ts +2 -0
- package/dist/components/batch-link.js +2 -1
- package/dist/components/chat-image-file.d.ts +3 -0
- package/dist/components/chat-image-file.js +48 -0
- package/dist/components/conversation-store.js +34 -4
- package/dist/components/copy.d.ts +14 -0
- package/dist/components/copy.js +14 -0
- package/dist/domain/batch.js +10 -3
- package/dist/domain/decide.js +9 -0
- package/dist/domain/new-block-review.d.ts +7 -0
- package/dist/domain/new-block-review.js +97 -0
- package/dist/domain/propose.d.ts +2 -0
- package/dist/domain/propose.js +39 -7
- package/dist/endpoints/chat.d.ts +3 -0
- package/dist/endpoints/chat.js +31 -2
- package/dist/endpoints/decide.js +27 -6
- package/dist/form/batch-revision.d.ts +6 -0
- package/dist/form/batch-revision.js +39 -0
- package/dist/form/diff.js +3 -2
- package/dist/form/relation-shape.d.ts +10 -5
- package/dist/form/relation-shape.js +104 -28
- package/dist/runtime/agent.d.ts +3 -1
- package/dist/runtime/agent.js +100 -8
- package/dist/runtime/context.d.ts +10 -8
- package/dist/runtime/context.js +16 -10
- package/dist/runtime/debug.d.ts +10 -0
- package/dist/runtime/debug.js +132 -0
- package/dist/runtime/system-prompt.js +4 -2
- package/dist/schema/fields.d.ts +6 -0
- package/dist/schema/fields.js +20 -2
- package/dist/styles/assistant.css +51 -0
- package/package.json +1 -1
package/dist/schema/fields.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { isDeniedFieldName } from "../config/denied-fields.js";
|
|
2
2
|
const SKIP_TYPES = new Set(["ui", "join", "row", "collapsible", "tabs"]);
|
|
3
|
+
// Trusted host callbacks stay server-side; neither discovery nor quoted model context serializes them.
|
|
4
|
+
const conditions = new WeakMap();
|
|
5
|
+
export function fieldCondition(field) {
|
|
6
|
+
return conditions.get(field);
|
|
7
|
+
}
|
|
3
8
|
export function isFieldAllowed(name, path, allowlist, denyFields) {
|
|
4
9
|
if (isDeniedFieldName(name) || denyFields.includes(name)) {
|
|
5
10
|
return false;
|
|
@@ -55,14 +60,27 @@ function walkField(field, parentPath, allowlist, denyFields) {
|
|
|
55
60
|
required: field.required,
|
|
56
61
|
localized: field.localized,
|
|
57
62
|
hasMany: field.hasMany,
|
|
58
|
-
...(field.hasMany
|
|
59
|
-
|
|
63
|
+
...((field.hasMany || type === "array" || type === "blocks") &&
|
|
64
|
+
typeof field.minRows === "number"
|
|
65
|
+
? { minRows: field.minRows }
|
|
66
|
+
: {}),
|
|
67
|
+
...((field.hasMany || type === "array" || type === "blocks") &&
|
|
68
|
+
typeof field.maxRows === "number"
|
|
69
|
+
? { maxRows: field.maxRows }
|
|
70
|
+
: {}),
|
|
60
71
|
relationTo: normalizeRelationTo(field.relationTo),
|
|
72
|
+
...(Array.isArray(field.relationTo) ? { polymorphic: true } : {}),
|
|
73
|
+
...(field.admin?.condition ? { conditional: true } : {}),
|
|
74
|
+
...(["string", "number", "boolean"].includes(typeof field.defaultValue)
|
|
75
|
+
? { defaultValue: field.defaultValue }
|
|
76
|
+
: {}),
|
|
61
77
|
options: optionValues(field.options),
|
|
62
78
|
label: asLabel(field.label) ?? field.name,
|
|
63
79
|
description: asLabel(field.admin?.description),
|
|
64
80
|
...(type === "richText" ? { editor: field.editor } : {}),
|
|
65
81
|
};
|
|
82
|
+
if (field.admin?.condition)
|
|
83
|
+
conditions.set(node, field.admin.condition);
|
|
66
84
|
if (type === "group" || type === "array") {
|
|
67
85
|
node.fields = walkFields(field.fields, path, allowlist, denyFields);
|
|
68
86
|
}
|
|
@@ -836,3 +836,54 @@ html[data-theme="dark"] .ea-trigger--open .ea-trigger__icon {
|
|
|
836
836
|
padding: calc(var(--base) * 0.5) var(--base) calc(var(--base) * 0.8);
|
|
837
837
|
border-top: 1px solid var(--theme-elevation-100);
|
|
838
838
|
}
|
|
839
|
+
|
|
840
|
+
/* The batch keeps its progress when the editor collapses the panel. */
|
|
841
|
+
.ea-aside[hidden] {
|
|
842
|
+
display: none;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.ea-images {
|
|
846
|
+
display: flex;
|
|
847
|
+
flex-wrap: wrap;
|
|
848
|
+
gap: 8px;
|
|
849
|
+
}
|
|
850
|
+
.ea-image {
|
|
851
|
+
position: relative;
|
|
852
|
+
width: 80px;
|
|
853
|
+
margin: 0;
|
|
854
|
+
font-size: 11px;
|
|
855
|
+
}
|
|
856
|
+
.ea-image img {
|
|
857
|
+
display: block;
|
|
858
|
+
width: 80px;
|
|
859
|
+
height: 64px;
|
|
860
|
+
object-fit: contain;
|
|
861
|
+
border: 1px solid var(--theme-elevation-200);
|
|
862
|
+
border-radius: var(--style-radius-s);
|
|
863
|
+
background: var(--theme-elevation-50);
|
|
864
|
+
}
|
|
865
|
+
.ea-image figcaption {
|
|
866
|
+
overflow: hidden;
|
|
867
|
+
white-space: nowrap;
|
|
868
|
+
text-overflow: ellipsis;
|
|
869
|
+
}
|
|
870
|
+
.ea-image button {
|
|
871
|
+
position: absolute;
|
|
872
|
+
right: -5px;
|
|
873
|
+
top: -5px;
|
|
874
|
+
width: 22px;
|
|
875
|
+
height: 22px;
|
|
876
|
+
border: 1px solid var(--theme-elevation-250);
|
|
877
|
+
border-radius: 50%;
|
|
878
|
+
background: var(--theme-elevation-0);
|
|
879
|
+
color: var(--theme-text);
|
|
880
|
+
cursor: pointer;
|
|
881
|
+
}
|
|
882
|
+
.ea-image-note {
|
|
883
|
+
margin: 0;
|
|
884
|
+
font-size: 12px;
|
|
885
|
+
color: var(--theme-elevation-600);
|
|
886
|
+
}
|
|
887
|
+
.ea-composer__bar {
|
|
888
|
+
justify-content: space-between;
|
|
889
|
+
}
|