@actuate-media/plugin-ai 0.0.2 → 0.0.3
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 -21
- package/dist/brand/profile-builder.js +10 -10
- package/dist/media/alt-text-generator.js +7 -7
- package/dist/media/auto-tagger.js +9 -9
- package/dist/translation/translator.js +3 -3
- package/dist/writing/assistant.js +7 -7
- package/dist/writing/inline-suggestions.js +9 -9
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Actuate Media
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Actuate Media
|
|
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.
|
|
@@ -46,16 +46,16 @@ export async function buildBrandProfile(content, options) {
|
|
|
46
46
|
return baseProfile;
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
const analysis = await options.provider.generateText(`Analyze the tone, style, and voice of the following content samples. Return a JSON object with:
|
|
50
|
-
- "tone": array of { "dimension": string, "value": number (0-1) } for dimensions like professional, friendly, authoritative, casual, technical, empathetic
|
|
51
|
-
- "preferred": array of commonly used words/phrases to keep
|
|
52
|
-
- "avoided": array of words/phrases that don't fit the voice
|
|
53
|
-
- "jargonLevel": "none" | "minimal" | "moderate" | "heavy"
|
|
54
|
-
- "formality": number 0-1 (0 = very casual, 1 = very formal)
|
|
55
|
-
- "activeVoiceRatio": estimated ratio 0-1 of active vs passive voice
|
|
56
|
-
- "expertise": "beginner" | "intermediate" | "expert"
|
|
57
|
-
|
|
58
|
-
Content samples:
|
|
49
|
+
const analysis = await options.provider.generateText(`Analyze the tone, style, and voice of the following content samples. Return a JSON object with:
|
|
50
|
+
- "tone": array of { "dimension": string, "value": number (0-1) } for dimensions like professional, friendly, authoritative, casual, technical, empathetic
|
|
51
|
+
- "preferred": array of commonly used words/phrases to keep
|
|
52
|
+
- "avoided": array of words/phrases that don't fit the voice
|
|
53
|
+
- "jargonLevel": "none" | "minimal" | "moderate" | "heavy"
|
|
54
|
+
- "formality": number 0-1 (0 = very casual, 1 = very formal)
|
|
55
|
+
- "activeVoiceRatio": estimated ratio 0-1 of active vs passive voice
|
|
56
|
+
- "expertise": "beginner" | "intermediate" | "expert"
|
|
57
|
+
|
|
58
|
+
Content samples:
|
|
59
59
|
${samples.slice(0, 5).join("\n---\n")}`, {
|
|
60
60
|
systemPrompt: "You are a brand voice analyst. Analyze writing patterns and return valid JSON only.",
|
|
61
61
|
maxTokens: 1024,
|
|
@@ -15,13 +15,13 @@ export async function generateAltText(imageUrl, context) {
|
|
|
15
15
|
context?.surroundingText && `Nearby text: ${context.surroundingText.slice(0, 300)}`,
|
|
16
16
|
context?.purpose && `Purpose: ${context.purpose}`,
|
|
17
17
|
].filter(Boolean).join("\n");
|
|
18
|
-
const prompt = `Analyze this image and generate accessible alt text.
|
|
19
|
-
|
|
20
|
-
${contextInfo ? `Context:\n${contextInfo}\n\n` : ""}Return a JSON object with:
|
|
21
|
-
- "altText": concise, descriptive alt text (max 125 characters)
|
|
22
|
-
- "alternatives": array of 2 alternative alt text options
|
|
23
|
-
- "confidence": number 0-1 for how confident you are
|
|
24
|
-
|
|
18
|
+
const prompt = `Analyze this image and generate accessible alt text.
|
|
19
|
+
|
|
20
|
+
${contextInfo ? `Context:\n${contextInfo}\n\n` : ""}Return a JSON object with:
|
|
21
|
+
- "altText": concise, descriptive alt text (max 125 characters)
|
|
22
|
+
- "alternatives": array of 2 alternative alt text options
|
|
23
|
+
- "confidence": number 0-1 for how confident you are
|
|
24
|
+
|
|
25
25
|
Image URL: ${imageUrl}`;
|
|
26
26
|
const result = await ai.generateText(prompt, {
|
|
27
27
|
systemPrompt: "You are an accessibility expert. Generate descriptive, concise alt text for images. Return valid JSON only.",
|
|
@@ -6,15 +6,15 @@ export async function autoTagImage(imageUrl, options) {
|
|
|
6
6
|
const categoryContext = options?.categories?.length
|
|
7
7
|
? `\nAvailable categories to choose from: ${options.categories.join(", ")}`
|
|
8
8
|
: "";
|
|
9
|
-
const prompt = `Analyze this image and provide tags, categories, and color information.
|
|
10
|
-
${categoryContext}
|
|
11
|
-
|
|
12
|
-
Return a JSON object with:
|
|
13
|
-
- "tags": array of objects with "label" and "confidence" (0-1), maximum ${maxTags} tags
|
|
14
|
-
- "categories": array of broad category strings (e.g., "nature", "technology", "people")
|
|
15
|
-
- "dominantColors": array of hex color strings for the dominant colors
|
|
16
|
-
- "isSafe": boolean indicating if the image is safe for work
|
|
17
|
-
|
|
9
|
+
const prompt = `Analyze this image and provide tags, categories, and color information.
|
|
10
|
+
${categoryContext}
|
|
11
|
+
|
|
12
|
+
Return a JSON object with:
|
|
13
|
+
- "tags": array of objects with "label" and "confidence" (0-1), maximum ${maxTags} tags
|
|
14
|
+
- "categories": array of broad category strings (e.g., "nature", "technology", "people")
|
|
15
|
+
- "dominantColors": array of hex color strings for the dominant colors
|
|
16
|
+
- "isSafe": boolean indicating if the image is safe for work
|
|
17
|
+
|
|
18
18
|
Image URL: ${imageUrl}`;
|
|
19
19
|
const result = await ai.generateText(prompt, {
|
|
20
20
|
systemPrompt: `You are an image analysis expert. Analyze images and return structured tags.${options?.language ? ` Respond in ${options.language}.` : ""} Return valid JSON only.`,
|
|
@@ -19,9 +19,9 @@ export async function translateContent(content, options) {
|
|
|
19
19
|
const formatInstruction = options.preserveFormatting !== false
|
|
20
20
|
? "\nPreserve all HTML tags, markdown formatting, and line breaks exactly."
|
|
21
21
|
: "";
|
|
22
|
-
const prompt = `Translate the following content from ${options.sourceLanguage} to ${options.targetLanguage}.${formatInstruction}${brandInstruction}${glossaryInstruction}
|
|
23
|
-
|
|
24
|
-
Content to translate:
|
|
22
|
+
const prompt = `Translate the following content from ${options.sourceLanguage} to ${options.targetLanguage}.${formatInstruction}${brandInstruction}${glossaryInstruction}
|
|
23
|
+
|
|
24
|
+
Content to translate:
|
|
25
25
|
${content}`;
|
|
26
26
|
const result = await ai.generateText(prompt, {
|
|
27
27
|
systemPrompt: "You are a professional translator. Translate accurately while preserving meaning, tone, and formatting. Return only the translated text, no explanations.",
|
|
@@ -82,13 +82,13 @@ export async function rewrite(text, style, tone, provider) {
|
|
|
82
82
|
/** Proofreads the given text and returns corrections with change types. */
|
|
83
83
|
export async function proofread(text, provider) {
|
|
84
84
|
const ai = provider ?? requireAIProvider();
|
|
85
|
-
const prompt = `Proofread the following text. Return a JSON object with:
|
|
86
|
-
- "corrected": the full corrected text
|
|
87
|
-
- "changes": array of objects with "original", "corrected", and "type" (one of: grammar, spelling, style, clarity)
|
|
88
|
-
|
|
89
|
-
Only include actual errors. If the text is correct, return an empty changes array.
|
|
90
|
-
|
|
91
|
-
Text to proofread:
|
|
85
|
+
const prompt = `Proofread the following text. Return a JSON object with:
|
|
86
|
+
- "corrected": the full corrected text
|
|
87
|
+
- "changes": array of objects with "original", "corrected", and "type" (one of: grammar, spelling, style, clarity)
|
|
88
|
+
|
|
89
|
+
Only include actual errors. If the text is correct, return an empty changes array.
|
|
90
|
+
|
|
91
|
+
Text to proofread:
|
|
92
92
|
${text}`;
|
|
93
93
|
const result = await ai.generateText(prompt, {
|
|
94
94
|
systemPrompt: "You are a professional proofreader. Return valid JSON only, no markdown formatting.",
|
|
@@ -4,15 +4,15 @@ export async function getSuggestions(text, cursorPosition, context) {
|
|
|
4
4
|
const ai = context?.provider ?? requireAIProvider();
|
|
5
5
|
const before = text.slice(Math.max(0, cursorPosition - 500), cursorPosition);
|
|
6
6
|
const after = text.slice(cursorPosition, cursorPosition + 200);
|
|
7
|
-
const prompt = `Given the following text context, provide 3 inline writing suggestions at the cursor position (marked with |).
|
|
8
|
-
|
|
9
|
-
Text before cursor: "${before}"
|
|
10
|
-
|
|
|
11
|
-
Text after cursor: "${after}"
|
|
12
|
-
|
|
13
|
-
Return a JSON array of objects with:
|
|
14
|
-
- "text": the suggested text to insert or replace
|
|
15
|
-
- "type": one of "completion", "improvement", or "alternative"
|
|
7
|
+
const prompt = `Given the following text context, provide 3 inline writing suggestions at the cursor position (marked with |).
|
|
8
|
+
|
|
9
|
+
Text before cursor: "${before}"
|
|
10
|
+
|
|
|
11
|
+
Text after cursor: "${after}"
|
|
12
|
+
|
|
13
|
+
Return a JSON array of objects with:
|
|
14
|
+
- "text": the suggested text to insert or replace
|
|
15
|
+
- "type": one of "completion", "improvement", or "alternative"
|
|
16
16
|
- "confidence": a number between 0 and 1`;
|
|
17
17
|
const result = await ai.generateText(prompt, {
|
|
18
18
|
systemPrompt: "You are a writing assistant providing inline suggestions. Return valid JSON only, no markdown.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actuate-media/plugin-ai",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/actuatecms/actuatecms.git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@actuate-media/cms-core": "0.2.
|
|
25
|
+
"@actuate-media/cms-core": "0.2.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "^19.0.0",
|