@forloop-cc/forloop-opencode-plugin-planner 2.2.15 → 2.2.16

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.15",
4
+ "version": "2.2.16",
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
  }
@@ -1,4 +1,8 @@
1
1
  const MIME_TYPES: Record<string, string> = {
2
+ '.html': 'text/html',
3
+ '.htm': 'text/html',
4
+ '.css': 'text/css',
5
+ '.svg': 'image/svg+xml',
2
6
  '.png': 'image/png',
3
7
  '.jpg': 'image/jpeg',
4
8
  '.jpeg': 'image/jpeg',
@@ -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,70 @@ 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
+ const response = await client.chatWithAI({
115
+ sprintId: args.sprintId,
116
+ message: args.message,
117
+ selectedAgentKey: 'forLoopCreator',
118
+ type: 'creator.generate',
119
+ metadata: { channel: 'creator_generate', storyId: args.storyId },
120
+ });
121
+
122
+ const taskId = response.taskId || response.id || 'unknown';
123
+ const trackingId = response.trackingId || 'unknown';
124
+
125
+ return `🎨 Creator dispatched for file generation
126
+
127
+ **Details:**
128
+ - Task ID: \`${taskId}\`
129
+ - Tracking ID: \`${trackingId}\`
130
+ - Sprint: #${args.sprintId}
131
+ - Story: #${args.storyId}
132
+ - Agent: forLoopCreator
133
+
134
+ **What happens next:**
135
+ 1. Sprint lock is acquired (conflicts if a developer task is running)
136
+ 2. ECS Fargate task starts the forLoopCreator agent
137
+ 3. Files are generated under frontend/public/ and committed
138
+ 4. Story is updated with a completion comment
139
+
140
+ **Monitor:** poll \`forloopDeveloperStatus(sprintId=${args.sprintId})\` for completion.`;
141
+ } catch (error: any) {
142
+ console.error('[forloopCreatorGenerate] Failed to trigger creator', error);
143
+ return `❌ Failed to trigger forLoopCreator: ${error.message}`;
144
+ }
145
+ },
146
+ });
147
+ }
@@ -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} Developer Task: ${exec.status}`,
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
- const download = await client.getFileDownloadUrl(args.fileId);
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**: ${download.url}`,
205
+ `**URL**: ${url}`,
202
206
  '',
203
207
  '⚠️ This URL may expire. Download the file soon.',
204
208
  ].join('\n');