@dudefactory/payload-plugin-content-planner 3.1.0 → 3.1.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/dist/collections/ContentTasks.d.ts +6 -0
- package/dist/collections/ContentTasks.js +161 -149
- package/dist/index.d.ts +21 -3
- package/dist/index.js +9 -4
- package/package.json +1 -1
|
@@ -9,5 +9,11 @@ import { CollectionConfig } from 'payload';
|
|
|
9
9
|
* - User Inputs: title, instructions, taskType, priority
|
|
10
10
|
* - Agent Outputs: status, outputLink, lastError, reviewFeedback
|
|
11
11
|
* - System: agentMetadata, parentTask, customParams
|
|
12
|
+
*
|
|
13
|
+
* @param outputCollections - The Payload collection slugs that the Agent can link
|
|
14
|
+
* to via `outputLink`. Pass the slug names of every collection the Agent may
|
|
15
|
+
* create content in (e.g. ['posts', 'public-events', 'factories']).
|
|
16
|
+
* Defaults to ['posts'] when omitted.
|
|
12
17
|
*/
|
|
18
|
+
export declare function createContentTasksCollection(outputCollections?: string[]): CollectionConfig;
|
|
13
19
|
export declare const contentTasksCollection: CollectionConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.contentTasksCollection = void 0;
|
|
4
|
+
exports.createContentTasksCollection = createContentTasksCollection;
|
|
4
5
|
/**
|
|
5
6
|
* Content Tasks Collection - The User Interface
|
|
6
7
|
*
|
|
@@ -11,165 +12,176 @@ exports.contentTasksCollection = void 0;
|
|
|
11
12
|
* - User Inputs: title, instructions, taskType, priority
|
|
12
13
|
* - Agent Outputs: status, outputLink, lastError, reviewFeedback
|
|
13
14
|
* - System: agentMetadata, parentTask, customParams
|
|
15
|
+
*
|
|
16
|
+
* @param outputCollections - The Payload collection slugs that the Agent can link
|
|
17
|
+
* to via `outputLink`. Pass the slug names of every collection the Agent may
|
|
18
|
+
* create content in (e.g. ['posts', 'public-events', 'factories']).
|
|
19
|
+
* Defaults to ['posts'] when omitted.
|
|
14
20
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
function createContentTasksCollection(outputCollections = ['posts']) {
|
|
22
|
+
return {
|
|
23
|
+
slug: 'cp-content-tasks',
|
|
24
|
+
admin: {
|
|
25
|
+
useAsTitle: 'title',
|
|
26
|
+
defaultColumns: ['title', 'taskType', 'status', 'priority', 'createdAt'],
|
|
27
|
+
group: 'Content Planning',
|
|
28
|
+
},
|
|
29
|
+
fields: [
|
|
30
|
+
// ========== USER INPUTS ==========
|
|
31
|
+
{
|
|
32
|
+
type: 'collapsible',
|
|
33
|
+
label: 'User Inputs',
|
|
34
|
+
fields: [
|
|
35
|
+
{
|
|
36
|
+
name: 'title',
|
|
37
|
+
label: 'Task Title',
|
|
38
|
+
type: 'text',
|
|
39
|
+
required: true,
|
|
40
|
+
maxLength: 150,
|
|
41
|
+
admin: {
|
|
42
|
+
placeholder: 'e.g., Write a blog post about cigar festivals in Miami',
|
|
43
|
+
},
|
|
36
44
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
{
|
|
46
|
+
name: 'instructions',
|
|
47
|
+
label: 'The Command',
|
|
48
|
+
type: 'textarea',
|
|
49
|
+
required: true,
|
|
50
|
+
admin: {
|
|
51
|
+
rows: 10,
|
|
52
|
+
placeholder: 'Detailed instructions for the Agent. e.g., "Write a blog post about cigar festivals in Miami. Include at least 3 events, 500 words, SEO keywords: cigars, Miami, festivals. Tone: conversational."',
|
|
53
|
+
},
|
|
46
54
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
defaultValue: 'new-content',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'priority',
|
|
64
|
-
label: 'Priority',
|
|
65
|
-
type: 'select',
|
|
66
|
-
required: true,
|
|
67
|
-
options: [
|
|
68
|
-
{ label: 'Low', value: 'low' },
|
|
69
|
-
{ label: 'Normal', value: 'normal' },
|
|
70
|
-
{ label: 'High', value: 'high' },
|
|
71
|
-
],
|
|
72
|
-
defaultValue: 'normal',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: 'deadline',
|
|
76
|
-
label: 'Deadline',
|
|
77
|
-
type: 'date',
|
|
78
|
-
required: false,
|
|
79
|
-
admin: {
|
|
80
|
-
placeholder: 'Optional: Set a deadline for this task',
|
|
55
|
+
{
|
|
56
|
+
name: 'taskType',
|
|
57
|
+
label: 'Task Type',
|
|
58
|
+
type: 'select',
|
|
59
|
+
required: true,
|
|
60
|
+
options: [
|
|
61
|
+
{ label: 'New Content', value: 'new-content' },
|
|
62
|
+
{ label: 'Update SEO', value: 'update-seo' },
|
|
63
|
+
{ label: 'Translation', value: 'translation' },
|
|
64
|
+
{ label: 'Social Media', value: 'social-media' },
|
|
65
|
+
{ label: 'Research', value: 'research' },
|
|
66
|
+
],
|
|
67
|
+
defaultValue: 'new-content',
|
|
81
68
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
name: 'status',
|
|
95
|
-
label: 'Status',
|
|
96
|
-
type: 'select',
|
|
97
|
-
required: true,
|
|
98
|
-
options: [
|
|
99
|
-
{ label: 'To Do', value: 'todo' },
|
|
100
|
-
{ label: 'In Progress', value: 'in-progress' },
|
|
101
|
-
{ label: 'In Review', value: 'review' },
|
|
102
|
-
{ label: 'Done', value: 'done' },
|
|
103
|
-
{ label: 'Failed', value: 'failed' },
|
|
104
|
-
],
|
|
105
|
-
defaultValue: 'todo',
|
|
106
|
-
admin: {
|
|
107
|
-
description: 'Set to "Failed" if the Agent encounters an error.',
|
|
69
|
+
{
|
|
70
|
+
name: 'priority',
|
|
71
|
+
label: 'Priority',
|
|
72
|
+
type: 'select',
|
|
73
|
+
required: true,
|
|
74
|
+
options: [
|
|
75
|
+
{ label: 'Low', value: 'low' },
|
|
76
|
+
{ label: 'Normal', value: 'normal' },
|
|
77
|
+
{ label: 'High', value: 'high' },
|
|
78
|
+
],
|
|
79
|
+
defaultValue: 'normal',
|
|
108
80
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
81
|
+
{
|
|
82
|
+
name: 'deadline',
|
|
83
|
+
label: 'Deadline',
|
|
84
|
+
type: 'date',
|
|
85
|
+
required: false,
|
|
86
|
+
admin: {
|
|
87
|
+
placeholder: 'Optional: Set a deadline for this task',
|
|
88
|
+
},
|
|
117
89
|
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
// ========== AGENT OUTPUTS ==========
|
|
93
|
+
{
|
|
94
|
+
type: 'collapsible',
|
|
95
|
+
label: 'Agent Outputs',
|
|
96
|
+
admin: {
|
|
97
|
+
description: 'Automatically populated by the Agent. Do not edit manually.',
|
|
118
98
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
99
|
+
fields: [
|
|
100
|
+
{
|
|
101
|
+
name: 'status',
|
|
102
|
+
label: 'Status',
|
|
103
|
+
type: 'select',
|
|
104
|
+
required: true,
|
|
105
|
+
options: [
|
|
106
|
+
{ label: 'To Do', value: 'todo' },
|
|
107
|
+
{ label: 'In Progress', value: 'in-progress' },
|
|
108
|
+
{ label: 'In Review', value: 'review' },
|
|
109
|
+
{ label: 'Done', value: 'done' },
|
|
110
|
+
{ label: 'Failed', value: 'failed' },
|
|
111
|
+
],
|
|
112
|
+
defaultValue: 'todo',
|
|
113
|
+
admin: {
|
|
114
|
+
description: 'Set to "Failed" if the Agent encounters an error.',
|
|
115
|
+
},
|
|
126
116
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
117
|
+
{
|
|
118
|
+
name: 'outputLink',
|
|
119
|
+
label: 'Output Link',
|
|
120
|
+
type: 'relationship',
|
|
121
|
+
// Injected at plugin registration time by the consuming project
|
|
122
|
+
relationTo: outputCollections,
|
|
123
|
+
admin: {
|
|
124
|
+
description: 'Crucial: Points to the generated Post, Page, Event, or other content created by the Agent.',
|
|
125
|
+
},
|
|
134
126
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
description: 'Advanced settings for the Agent and system integration.',
|
|
144
|
-
},
|
|
145
|
-
fields: [
|
|
146
|
-
{
|
|
147
|
-
name: 'agentMetadata',
|
|
148
|
-
label: 'Agent Metadata',
|
|
149
|
-
type: 'json',
|
|
150
|
-
admin: {
|
|
151
|
-
description: 'Stores tokens consumed, model used, estimated cost, latency (ms). Auto-populated by Agent.',
|
|
127
|
+
{
|
|
128
|
+
name: 'lastError',
|
|
129
|
+
label: 'Last Error',
|
|
130
|
+
type: 'textarea',
|
|
131
|
+
admin: {
|
|
132
|
+
rows: 4,
|
|
133
|
+
description: 'If status is "Failed", the Agent writes the technical error here.',
|
|
134
|
+
},
|
|
152
135
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
description: 'Links to a parent Campaign, Epic, or meta-task if this is a subtask.',
|
|
136
|
+
{
|
|
137
|
+
name: 'reviewFeedback',
|
|
138
|
+
label: 'Review Feedback',
|
|
139
|
+
type: 'richText',
|
|
140
|
+
admin: {
|
|
141
|
+
description: 'User notes for the Agent to "try again". Leave blank if not in review.',
|
|
142
|
+
},
|
|
161
143
|
},
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
// ========== SYSTEM / AGENT METADATA ==========
|
|
147
|
+
{
|
|
148
|
+
type: 'collapsible',
|
|
149
|
+
label: 'System & Configuration',
|
|
150
|
+
admin: {
|
|
151
|
+
description: 'Advanced settings for the Agent and system integration.',
|
|
162
152
|
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
153
|
+
fields: [
|
|
154
|
+
{
|
|
155
|
+
name: 'agentMetadata',
|
|
156
|
+
label: 'Agent Metadata',
|
|
157
|
+
type: 'json',
|
|
158
|
+
admin: {
|
|
159
|
+
description: 'Stores tokens consumed, model used, estimated cost, latency (ms). Auto-populated by Agent.',
|
|
160
|
+
},
|
|
169
161
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
{
|
|
163
|
+
name: 'parentTask',
|
|
164
|
+
label: 'Parent Task',
|
|
165
|
+
type: 'relationship',
|
|
166
|
+
relationTo: 'cp-content-tasks',
|
|
167
|
+
admin: {
|
|
168
|
+
description: 'Links to a parent Campaign, Epic, or meta-task if this is a subtask.',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'customParams',
|
|
173
|
+
label: 'Custom Parameters',
|
|
174
|
+
type: 'json',
|
|
175
|
+
admin: {
|
|
176
|
+
description: 'The Escape Hatch: Use this if you need to pass data you forgot to add to the schema. Agent-writable.',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
timestamps: true,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
// Backwards-compatible named export — uses ['posts'] as default fallback.
|
|
186
|
+
// Prefer using createContentTasksCollection() directly via the plugin config.
|
|
187
|
+
exports.contentTasksCollection = createContentTasksCollection();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from 'payload';
|
|
2
|
-
import { contentTasksCollection } from './collections/ContentTasks';
|
|
2
|
+
import { createContentTasksCollection, contentTasksCollection } from './collections/ContentTasks';
|
|
3
3
|
import { keywordsCollection } from './collections/Keywords';
|
|
4
4
|
import { instructionsCollection } from './collections/Instructions';
|
|
5
5
|
import { auditLogsCollection } from './collections/AuditLogs';
|
|
@@ -129,9 +129,23 @@ export declare const contentPlannerPrompts: ({
|
|
|
129
129
|
};
|
|
130
130
|
})[];
|
|
131
131
|
export { generateInitInstruction, warmupInitialization, setupInstructions, generateContentTask, executeContentTask, };
|
|
132
|
-
export { contentTasksCollection, keywordsCollection, instructionsCollection, auditLogsCollection, performanceCollection, };
|
|
132
|
+
export { createContentTasksCollection, contentTasksCollection, keywordsCollection, instructionsCollection, auditLogsCollection, performanceCollection, };
|
|
133
133
|
export interface ContentPlannerPluginConfig {
|
|
134
134
|
enabled?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* The Payload collection slugs that the Agent can link output documents to
|
|
137
|
+
* via the `outputLink` relationship field on cp-content-tasks.
|
|
138
|
+
*
|
|
139
|
+
* List every collection slug in your project that the Agent may create
|
|
140
|
+
* content in. For example:
|
|
141
|
+
*
|
|
142
|
+
* ```ts
|
|
143
|
+
* outputCollections: ['posts', 'public-events', 'factories', 'cities']
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* Defaults to `['posts']` when omitted.
|
|
147
|
+
*/
|
|
148
|
+
outputCollections?: string[];
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
151
|
* Payload Content Planner Plugin
|
|
@@ -163,7 +177,11 @@ export interface ContentPlannerPluginConfig {
|
|
|
163
177
|
*
|
|
164
178
|
* export default buildConfig({
|
|
165
179
|
* plugins: [
|
|
166
|
-
* contentPlannerPlugin({
|
|
180
|
+
* contentPlannerPlugin({
|
|
181
|
+
* enabled: true,
|
|
182
|
+
* // Tell the plugin which collections exist in YOUR project
|
|
183
|
+
* outputCollections: ['posts', 'public-events', 'factories', 'cities'],
|
|
184
|
+
* }),
|
|
167
185
|
* // Add to your existing MCP plugin to enable agent execution:
|
|
168
186
|
* // mcpPlugin({ prompts: contentPlannerPrompts })
|
|
169
187
|
* ],
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.contentPlannerPlugin = exports.performanceCollection = exports.auditLogsCollection = exports.instructionsCollection = exports.keywordsCollection = exports.contentTasksCollection = exports.executeContentTask = exports.generateContentTask = exports.setupInstructions = exports.warmupInitialization = exports.generateInitInstruction = exports.contentPlannerPrompts = void 0;
|
|
3
|
+
exports.contentPlannerPlugin = exports.performanceCollection = exports.auditLogsCollection = exports.instructionsCollection = exports.keywordsCollection = exports.contentTasksCollection = exports.createContentTasksCollection = exports.executeContentTask = exports.generateContentTask = exports.setupInstructions = exports.warmupInitialization = exports.generateInitInstruction = exports.contentPlannerPrompts = void 0;
|
|
4
4
|
const ContentTasks_1 = require("./collections/ContentTasks");
|
|
5
|
+
Object.defineProperty(exports, "createContentTasksCollection", { enumerable: true, get: function () { return ContentTasks_1.createContentTasksCollection; } });
|
|
5
6
|
Object.defineProperty(exports, "contentTasksCollection", { enumerable: true, get: function () { return ContentTasks_1.contentTasksCollection; } });
|
|
6
7
|
const Keywords_1 = require("./collections/Keywords");
|
|
7
8
|
Object.defineProperty(exports, "keywordsCollection", { enumerable: true, get: function () { return Keywords_1.keywordsCollection; } });
|
|
@@ -55,7 +56,11 @@ exports.contentPlannerPrompts = [
|
|
|
55
56
|
*
|
|
56
57
|
* export default buildConfig({
|
|
57
58
|
* plugins: [
|
|
58
|
-
* contentPlannerPlugin({
|
|
59
|
+
* contentPlannerPlugin({
|
|
60
|
+
* enabled: true,
|
|
61
|
+
* // Tell the plugin which collections exist in YOUR project
|
|
62
|
+
* outputCollections: ['posts', 'public-events', 'factories', 'cities'],
|
|
63
|
+
* }),
|
|
59
64
|
* // Add to your existing MCP plugin to enable agent execution:
|
|
60
65
|
* // mcpPlugin({ prompts: contentPlannerPrompts })
|
|
61
66
|
* ],
|
|
@@ -63,7 +68,7 @@ exports.contentPlannerPrompts = [
|
|
|
63
68
|
* ```
|
|
64
69
|
*/
|
|
65
70
|
const contentPlannerPlugin = (config = {}) => (incomingConfig) => {
|
|
66
|
-
const { enabled = true } = config;
|
|
71
|
+
const { enabled = true, outputCollections = ['posts'] } = config;
|
|
67
72
|
if (!enabled) {
|
|
68
73
|
return incomingConfig;
|
|
69
74
|
}
|
|
@@ -71,7 +76,7 @@ const contentPlannerPlugin = (config = {}) => (incomingConfig) => {
|
|
|
71
76
|
...incomingConfig,
|
|
72
77
|
collections: [
|
|
73
78
|
...(incomingConfig.collections || []),
|
|
74
|
-
ContentTasks_1.
|
|
79
|
+
(0, ContentTasks_1.createContentTasksCollection)(outputCollections),
|
|
75
80
|
Keywords_1.keywordsCollection,
|
|
76
81
|
Instructions_1.instructionsCollection,
|
|
77
82
|
AuditLogs_1.auditLogsCollection,
|
package/package.json
CHANGED