@jl1990/pi-scheduler 0.2.3 → 0.2.4

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.
@@ -170,9 +170,11 @@ export default function schedulerExtension(pi: ExtensionAPI) {
170
170
 
171
171
  const lines = ["⏰ Scheduled Actions"];
172
172
  for (const task of upcoming) {
173
- const next = task.nextRun ? core.formatRelativeTime(task.nextRun) : "no next run";
173
+ const relative = task.nextRun ? core.formatRelativeTime(task.nextRun) : "no next run";
174
+ const absolute = task.nextRun ? core.formatAbsoluteTime(task.nextRun) : "";
175
+ const when = absolute ? `${relative} (${absolute})` : relative;
174
176
  const last = task.lastStatus ? ` last=${task.lastStatus}` : "";
175
- lines.push(` ✓ ${taskLabel(task)} ${task.action}/${task.type} ${next} runs=${task.runCount ?? 0}${last}`);
177
+ lines.push(` ✓ ${taskLabel(task)} ${task.action}/${task.type} ${when} runs=${task.runCount ?? 0}${last}`);
176
178
  }
177
179
  ctx.ui.setWidget("scheduler", lines, { placement: "belowEditor" });
178
180
  }
@@ -670,6 +670,24 @@ function formatRelativeTime(dueAt, nowValue = new Date()) {
670
670
  return `in ${parts.join(" ") || "<1s"}`;
671
671
  }
672
672
 
673
+ function formatAbsoluteTime(nextRun, nowValue = new Date()) {
674
+ const date = new Date(nextRun);
675
+ if (!Number.isFinite(date.getTime())) return "unknown";
676
+ const now = asDate(nowValue);
677
+ const tomorrow = new Date(now);
678
+ tomorrow.setDate(tomorrow.getDate() + 1);
679
+
680
+ const timeStr = date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: false });
681
+
682
+ if (date.toDateString() === now.toDateString()) {
683
+ return `at ${timeStr}`;
684
+ }
685
+ if (date.toDateString() === tomorrow.toDateString()) {
686
+ return `tomorrow at ${timeStr}`;
687
+ }
688
+ return `on ${date.toLocaleDateString([], { month: "short", day: "numeric" })} at ${timeStr}`;
689
+ }
690
+
673
691
  function formatSchedule(task) {
674
692
  if (task.type === "interval") return `every ${task.schedule}`;
675
693
  if (task.type === "cron") return `cron ${task.schedule}`;
@@ -726,6 +744,7 @@ module.exports = {
726
744
  markScheduledTaskFailed,
727
745
  shouldWakeForShellResult,
728
746
  selectShellFollowUpPrompt,
747
+ formatAbsoluteTime,
729
748
  formatRelativeTime,
730
749
  formatTaskLine,
731
750
  formatTaskList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jl1990/pi-scheduler",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Give Pi coding agents a clock: schedule reminders, shell commands, and self-waking prompts for CI polling and autonomous follow-ups.",
5
5
  "author": "jl1990",
6
6
  "license": "MIT",