@masslessai/push-todo 3.6.7 → 3.6.9

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.
Files changed (2) hide show
  1. package/lib/daemon.js +41 -3
  2. package/package.json +1 -1
package/lib/daemon.js CHANGED
@@ -338,6 +338,24 @@ async function updateTaskStatus(displayNumber, status, extra = {}) {
338
338
  payload.machineName = machineName;
339
339
  }
340
340
 
341
+ // Auto-generate execution event for timeline
342
+ if (!payload.event) {
343
+ const eventType = status === 'running' ? 'started'
344
+ : status === 'completed' ? 'completed'
345
+ : status === 'failed' ? 'failed'
346
+ : null;
347
+ if (eventType) {
348
+ payload.event = {
349
+ type: eventType,
350
+ timestamp: new Date().toISOString(),
351
+ machineName: machineName || undefined,
352
+ };
353
+ if (extra.summary) payload.event.summary = extra.summary;
354
+ if (extra.error) payload.event.summary = extra.error;
355
+ if (extra.sessionId) payload.event.sessionId = extra.sessionId;
356
+ }
357
+ }
358
+
341
359
  const response = await apiRequest('update-task-execution', {
342
360
  method: 'PATCH',
343
361
  body: JSON.stringify(payload)
@@ -785,8 +803,15 @@ IMPORTANT:
785
803
  2. ALWAYS commit your changes before finishing. Use a descriptive commit message summarizing what you did. This is critical — uncommitted changes will be lost when the worktree is cleaned up.
786
804
  3. When you're done, the SessionEnd hook will automatically report completion to Supabase.`;
787
805
 
788
- // Update status to running
789
- updateTaskStatus(displayNumber, 'running');
806
+ // Update status to running (auto-generates 'started' event)
807
+ updateTaskStatus(displayNumber, 'running', {
808
+ event: {
809
+ type: 'started',
810
+ timestamp: new Date().toISOString(),
811
+ machineName: getMachineName() || undefined,
812
+ summary: summary.slice(0, 100),
813
+ }
814
+ });
790
815
 
791
816
  // Build Claude command
792
817
  const allowedTools = [
@@ -1215,12 +1240,25 @@ async function mainLoop() {
1215
1240
  function cleanup() {
1216
1241
  log('Daemon shutting down...');
1217
1242
 
1218
- // Kill running tasks
1243
+ // Kill running tasks and mark them as failed in Supabase
1219
1244
  for (const [displayNumber, taskInfo] of runningTasks) {
1220
1245
  log(`Killing task #${displayNumber}`);
1221
1246
  try {
1222
1247
  taskInfo.process.kill('SIGTERM');
1223
1248
  } catch {}
1249
+ // Mark as failed so the task doesn't stay as 'running' forever
1250
+ const duration = Math.floor((Date.now() - taskInfo.startTime) / 1000);
1251
+ updateTaskStatus(displayNumber, 'failed', {
1252
+ error: `Daemon shutdown after ${duration}s`,
1253
+ event: {
1254
+ type: 'daemon_shutdown',
1255
+ timestamp: new Date().toISOString(),
1256
+ machineName: getMachineName() || undefined,
1257
+ summary: `Daemon restarted after ${duration}s`,
1258
+ }
1259
+ });
1260
+ const projectPath = taskProjectPaths.get(displayNumber);
1261
+ cleanupWorktree(displayNumber, projectPath);
1224
1262
  }
1225
1263
 
1226
1264
  // Clean up files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masslessai/push-todo",
3
- "version": "3.6.7",
3
+ "version": "3.6.9",
4
4
  "description": "Voice tasks from Push iOS app for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {