@forloop-cc/forloop-opencode-plugin-planner 2.2.15 → 2.2.17
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@forloop-cc/forloop-opencode-plugin-planner",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.17",
|
|
5
5
|
"description": "ForLoop integration plugin for opencode — Sprint, story, and agent tools for the ForLoop platform",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -76,7 +76,7 @@ export interface ChatRequest {
|
|
|
76
76
|
message: string;
|
|
77
77
|
sprintId?: number;
|
|
78
78
|
selectedAgentKey?: string;
|
|
79
|
-
type?: 'chat' | 'summary' | 'suggestion' | 'analysis' | 'translation' | 'feature' | 'planner.chat' | 'developer.sprint';
|
|
79
|
+
type?: 'chat' | 'summary' | 'suggestion' | 'analysis' | 'translation' | 'feature' | 'planner.chat' | 'developer.sprint' | 'creator.generate';
|
|
80
80
|
conversationId?: string;
|
|
81
81
|
metadata?: any;
|
|
82
82
|
}
|
|
@@ -9,6 +9,7 @@ export function createAITriggerTools(client: ForLoopAPIClient) {
|
|
|
9
9
|
const tools: Record<string, ReturnType<typeof tool>> = {};
|
|
10
10
|
|
|
11
11
|
tools['forloopAiDeveloperSpaceSprint'] = createDeveloperSprintTool(client);
|
|
12
|
+
tools['forloopCreatorGenerate'] = createCreatorGenerateTool(client);
|
|
12
13
|
|
|
13
14
|
return tools;
|
|
14
15
|
}
|
|
@@ -77,3 +78,76 @@ function createDeveloperSprintTool(client: ForLoopAPIClient) {
|
|
|
77
78
|
},
|
|
78
79
|
});
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* forloopCreatorGenerate - Trigger forLoopCreator agent on-demand during planning.
|
|
84
|
+
* Dispatches the Creator via EventBridge → Step Functions → ECS (same path as
|
|
85
|
+
* developer.sprint) using selectedAgentKey=forLoopCreator and type=creator.generate.
|
|
86
|
+
* The planner MUST pre-create a Creator story (forloopStoryTemplate with
|
|
87
|
+
* assigneeAgentKey="forLoopCreator") before dispatching.
|
|
88
|
+
*/
|
|
89
|
+
function createCreatorGenerateTool(client: ForLoopAPIClient) {
|
|
90
|
+
return tool({
|
|
91
|
+
description: 'Trigger the forLoopCreator agent on-demand during planning to generate files (documents, presentations, spreadsheets, music, images, video). Requires a story to be pre-created via forloopStoryTemplate(assigneeAgentKey="forLoopCreator") first. Generated files land under frontend/public/ and auto-deploy via CI/CD.',
|
|
92
|
+
args: {
|
|
93
|
+
sprintId: tool.schema.number()
|
|
94
|
+
.describe('Sprint ID'),
|
|
95
|
+
storyId: tool.schema.number()
|
|
96
|
+
.describe('Pre-created Creator story ID (from forloopStoryTemplate with assigneeAgentKey="forLoopCreator")'),
|
|
97
|
+
message: tool.schema.string()
|
|
98
|
+
.optional()
|
|
99
|
+
.describe('Generation instructions, including the story ID and desired output')
|
|
100
|
+
.default('Generate the files described in the assigned story'),
|
|
101
|
+
},
|
|
102
|
+
async execute(args, _context) {
|
|
103
|
+
const tokenResult = await validateToken();
|
|
104
|
+
if (!tokenResult.valid) {
|
|
105
|
+
return tokenResult.error;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
console.log('[forloopCreatorGenerate] Triggering creator agent', {
|
|
110
|
+
sprintId: args.sprintId,
|
|
111
|
+
storyId: args.storyId,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// The ECS pipeline (EventBridge → SFN → ECS) does not carry `metadata`,
|
|
115
|
+
// so the Creator agent only ever sees the `message`. Bake the storyId into
|
|
116
|
+
// the message so the Creator can forloopContextFetch the correct story.
|
|
117
|
+
const baseMessage = args.message || 'Generate the files described in the assigned story';
|
|
118
|
+
const message = `${baseMessage}\n\nTarget story ID: ${args.storyId}`;
|
|
119
|
+
|
|
120
|
+
const response = await client.chatWithAI({
|
|
121
|
+
sprintId: args.sprintId,
|
|
122
|
+
message,
|
|
123
|
+
selectedAgentKey: 'forLoopCreator',
|
|
124
|
+
type: 'creator.generate',
|
|
125
|
+
metadata: { channel: 'creator_generate', storyId: args.storyId },
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const taskId = response.taskId || response.id || 'unknown';
|
|
129
|
+
const trackingId = response.trackingId || 'unknown';
|
|
130
|
+
|
|
131
|
+
return `🎨 Creator dispatched for file generation
|
|
132
|
+
|
|
133
|
+
**Details:**
|
|
134
|
+
- Task ID: \`${taskId}\`
|
|
135
|
+
- Tracking ID: \`${trackingId}\`
|
|
136
|
+
- Sprint: #${args.sprintId}
|
|
137
|
+
- Story: #${args.storyId}
|
|
138
|
+
- Agent: forLoopCreator
|
|
139
|
+
|
|
140
|
+
**What happens next:**
|
|
141
|
+
1. Sprint lock is acquired (conflicts if a developer task is running)
|
|
142
|
+
2. ECS Fargate task starts the forLoopCreator agent
|
|
143
|
+
3. Files are generated under frontend/public/ and committed
|
|
144
|
+
4. Story is updated with a completion comment
|
|
145
|
+
|
|
146
|
+
**Monitor:** poll \`forloopDeveloperStatus(sprintId=${args.sprintId})\` for completion.`;
|
|
147
|
+
} catch (error: any) {
|
|
148
|
+
console.error('[forloopCreatorGenerate] Failed to trigger creator', error);
|
|
149
|
+
return `❌ Failed to trigger forLoopCreator: ${error.message}`;
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
});
|
|
153
|
+
}
|
|
@@ -49,9 +49,11 @@ export function createDeveloperStatusTool(client: ForLoopAPIClient) {
|
|
|
49
49
|
const exec = status.execution || {};
|
|
50
50
|
const sprint = status.sprint || {};
|
|
51
51
|
const execIcon = SFN_ICONS[exec.status] || '❓';
|
|
52
|
+
const isCreator = String(task.agentKey || '').toLowerCase() === 'forloopcreator';
|
|
53
|
+
const taskLabel = isCreator ? 'Creator Task' : 'Developer Task';
|
|
52
54
|
|
|
53
55
|
const lines = [
|
|
54
|
-
`${execIcon}
|
|
56
|
+
`${execIcon} ${taskLabel}: ${exec.status}`,
|
|
55
57
|
'',
|
|
56
58
|
`**Sprint**: #${resolution.sprintId}`,
|
|
57
59
|
`**Task Status**: ${task.status} (${task.id ? task.id.substring(0, 8) : '?'})`,
|
|
@@ -82,6 +82,7 @@ export function createFileUploadTool(client: ForLoopAPIClient) {
|
|
|
82
82
|
`✅ File uploaded successfully!`,
|
|
83
83
|
'',
|
|
84
84
|
`**File**: ${fileName}`,
|
|
85
|
+
`**File ID**: ${complete.id}`,
|
|
85
86
|
`**Size**: ${formatFileSize(fileSize)}`,
|
|
86
87
|
`**URL**: ${complete.url}`,
|
|
87
88
|
args.description ? `**Description**: ${args.description}` : null,
|
|
@@ -192,13 +193,16 @@ export function createFileDownloadUrlTool(client: ForLoopAPIClient) {
|
|
|
192
193
|
// Fire-and-forget audit log — don't block download on audit failure
|
|
193
194
|
client.logFileRead(args.fileId).catch(() => {});
|
|
194
195
|
|
|
195
|
-
|
|
196
|
+
// Use open-url (returns JSON {url}) rather than download (which 302-redirects
|
|
197
|
+
// to the signed URL — the plugin's fetch would follow it and fail JSON parsing).
|
|
198
|
+
const open = await client.getFileOpenUrl(args.fileId);
|
|
199
|
+
const url = String(open?.openUrl || open?.url || '');
|
|
196
200
|
|
|
197
201
|
return [
|
|
198
202
|
`📥 Download URL`,
|
|
199
203
|
'',
|
|
200
204
|
`**File ID**: ${args.fileId}`,
|
|
201
|
-
`**URL**: ${
|
|
205
|
+
`**URL**: ${url}`,
|
|
202
206
|
'',
|
|
203
207
|
'⚠️ This URL may expire. Download the file soon.',
|
|
204
208
|
].join('\n');
|