everydaytok commited on
Commit
4e064dc
·
verified ·
1 Parent(s): 01043cc

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +12 -0
app.js CHANGED
@@ -168,11 +168,19 @@ async function executeCommands(userId, projectId, commands) {
168
  flags.newThrustId = thrust.id;
169
  flags.newThrustMarkdown = cmd.payload.markdown_content;
170
  }
 
 
 
 
171
  }
172
 
173
  if (cmd.type === 'log_timeline') {
174
  await supabase.from('timeline_events').insert({ lead_id: projectId, title: cmd.payload.title, description: cmd.payload.description, type: (cmd.payload.type || 'system').toLowerCase() });
175
  flags.shouldReload = true;
 
 
 
 
176
  }
177
 
178
  if (cmd.type === 'update_requirements') {
@@ -189,6 +197,10 @@ async function executeCommands(userId, projectId, commands) {
189
  if (active) {
190
  await supabase.from('thrust_tasks').update({ status: 'done' }).eq('thrust_id', active.id).ilike('title', `%${cmd.payload}%`);
191
  flags.shouldReload = true;
 
 
 
 
192
  }
193
  }
194
 
 
168
  flags.newThrustId = thrust.id;
169
  flags.newThrustMarkdown = cmd.payload.markdown_content;
170
  }
171
+
172
+ if (FRONT_URL) {
173
+ fetch(`${FRONT_URL}/internal/notify`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ user_id: userId, type: 'toast', message: `🚀 New Thrust Generated: ${cmd.payload.title}` }) }).catch(() => {});
174
+ }
175
  }
176
 
177
  if (cmd.type === 'log_timeline') {
178
  await supabase.from('timeline_events').insert({ lead_id: projectId, title: cmd.payload.title, description: cmd.payload.description, type: (cmd.payload.type || 'system').toLowerCase() });
179
  flags.shouldReload = true;
180
+
181
+ if (FRONT_URL) {
182
+ fetch(`${FRONT_URL}/internal/notify`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ user_id: userId, type: 'toast', message: `🕒 Timeline Updated: ${cmd.payload.title}` }) }).catch(() => {});
183
+ }
184
  }
185
 
186
  if (cmd.type === 'update_requirements') {
 
197
  if (active) {
198
  await supabase.from('thrust_tasks').update({ status: 'done' }).eq('thrust_id', active.id).ilike('title', `%${cmd.payload}%`);
199
  flags.shouldReload = true;
200
+
201
+ if (FRONT_URL) {
202
+ fetch(`${FRONT_URL}/internal/notify`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ user_id: userId, type: 'toast', message: `✅ AI Verified Task: ${cmd.payload}` }) }).catch(() => {});
203
+ }
204
  }
205
  }
206