palmier 0.7.8 → 0.8.0

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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/commands/run.js +55 -0
  3. package/dist/commands/serve.js +22 -2
  4. package/dist/event-queues.d.ts +36 -0
  5. package/dist/event-queues.js +53 -0
  6. package/dist/mcp-tools.d.ts +2 -0
  7. package/dist/mcp-tools.js +4 -2
  8. package/dist/platform/linux.js +11 -8
  9. package/dist/platform/windows.d.ts +5 -6
  10. package/dist/platform/windows.js +19 -13
  11. package/dist/pwa/assets/index-FP1Mipr6.js +120 -0
  12. package/dist/pwa/assets/index-bLTn8zBj.css +1 -0
  13. package/dist/pwa/assets/{web-BNr628AV.js → web-BpM3fNCn.js} +1 -1
  14. package/dist/pwa/assets/{web-DyQPewAi.js → web-CF-N8Di6.js} +1 -1
  15. package/dist/pwa/index.html +2 -2
  16. package/dist/pwa/service-worker.js +1 -1
  17. package/dist/rpc-handler.js +25 -9
  18. package/dist/task.js +1 -1
  19. package/dist/transports/http-transport.js +18 -5
  20. package/dist/types.d.ts +10 -6
  21. package/package.json +1 -1
  22. package/palmier-server/README.md +3 -3
  23. package/palmier-server/pwa/src/App.css +117 -36
  24. package/palmier-server/pwa/src/components/PullToRefreshIndicator.tsx +46 -0
  25. package/palmier-server/pwa/src/components/RunDetailView.tsx +58 -15
  26. package/palmier-server/pwa/src/components/SessionComposer.tsx +20 -10
  27. package/palmier-server/pwa/src/components/{RunsView.tsx → SessionsView.tsx} +33 -25
  28. package/palmier-server/pwa/src/components/TaskCard.tsx +33 -35
  29. package/palmier-server/pwa/src/components/TaskForm.tsx +274 -293
  30. package/palmier-server/pwa/src/components/{TaskListView.tsx → TasksView.tsx} +20 -13
  31. package/palmier-server/pwa/src/contexts/HostStoreContext.tsx +16 -8
  32. package/palmier-server/pwa/src/hooks/usePullToRefresh.ts +102 -0
  33. package/palmier-server/pwa/src/pages/Dashboard.tsx +9 -26
  34. package/palmier-server/pwa/src/types.ts +5 -9
  35. package/palmier-server/spec.md +23 -23
  36. package/src/commands/run.ts +61 -0
  37. package/src/commands/serve.ts +22 -2
  38. package/src/event-queues.ts +56 -0
  39. package/src/mcp-tools.ts +6 -2
  40. package/src/platform/linux.ts +10 -8
  41. package/src/platform/windows.ts +19 -13
  42. package/src/rpc-handler.ts +28 -11
  43. package/src/task.ts +1 -1
  44. package/src/transports/http-transport.ts +17 -5
  45. package/src/types.ts +10 -7
  46. package/dist/pwa/assets/index-8cTctVnD.js +0 -120
  47. package/dist/pwa/assets/index-CSUkBBsQ.css +0 -1
@@ -23,8 +23,9 @@ export default function TaskCard({ task, lastEvent, onEdit, onDelete, onViewRun
23
23
  const menuRef = useRef<HTMLDivElement>(null);
24
24
 
25
25
  const isRunning = lastEvent?.running_state === "started";
26
+ const scheduleActive = !!task.schedule_enabled && !!task.schedule_type && (task.schedule_values?.length ?? 0) > 0;
26
27
  const stateColor =
27
- !task.triggers_enabled || task.triggers.length === 0
28
+ !scheduleActive
28
29
  ? "var(--color-text-secondary)"
29
30
  : isRunning
30
31
  ? "var(--color-success)"
@@ -99,34 +100,14 @@ export default function TaskCard({ task, lastEvent, onEdit, onDelete, onViewRun
99
100
  };
100
101
 
101
102
 
102
- function formatTriggersGrouped(triggers: { type: string; value: string }[]): string {
103
- if (triggers.length === 0) return "";
104
- if (triggers.length === 1) return formatSingleTrigger(triggers[0]);
105
-
106
- // Detect the shared schedule type
107
- const classified = triggers.map(classifyTrigger);
108
- const types = new Set(classified.map((c) => c.kind));
109
-
110
- // If all the same type, group them
111
- if (types.size === 1) {
112
- const kind = classified[0].kind;
113
- if (kind === "hourly") return "Every hour";
114
- const details = classified.map((c) => c.detail);
115
- return `${kind.charAt(0).toUpperCase() + kind.slice(1)}: ${details.join(", ")}`;
116
- }
117
-
118
- // Mixed types — fall back to listing each
119
- return triggers.map(formatSingleTrigger).join(", ");
120
- }
121
-
122
- function classifyTrigger(t: { type: string; value: string }): { kind: string; detail: string } {
123
- if (t.type === "once") {
124
- const d = new Date(t.value);
125
- const label = isNaN(d.getTime()) ? t.value : `${d.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })} at ${d.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" })}`;
126
- return { kind: "once", detail: label };
103
+ function classifyValue(scheduleType: "crons" | "specific_times", value: string): { kind: string; detail: string } {
104
+ if (scheduleType === "specific_times") {
105
+ const d = new Date(value);
106
+ const label = isNaN(d.getTime()) ? value : `${d.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })} at ${d.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" })}`;
107
+ return { kind: "specific_times", detail: label };
127
108
  }
128
- const parts = t.value.split(" ");
129
- if (parts.length !== 5) return { kind: "unknown", detail: t.value };
109
+ const parts = value.split(" ");
110
+ if (parts.length !== 5) return { kind: "unknown", detail: value };
130
111
  const [min, hour, dom, , dow] = parts;
131
112
  const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
132
113
  if (hour === "*") return { kind: "hourly", detail: "" };
@@ -138,14 +119,31 @@ export default function TaskCard({ task, lastEvent, onEdit, onDelete, onViewRun
138
119
  return { kind: "daily", detail: time };
139
120
  }
140
121
 
141
- function formatSingleTrigger(t: { type: string; value: string }): string {
142
- const c = classifyTrigger(t);
122
+ function formatSingleValue(scheduleType: "crons" | "specific_times", value: string): string {
123
+ const c = classifyValue(scheduleType, value);
143
124
  if (c.kind === "hourly") return "Every hour";
144
- if (c.kind === "once") return `Once on ${c.detail}`;
125
+ if (c.kind === "specific_times") return `Once on ${c.detail}`;
145
126
  return `${c.kind.charAt(0).toUpperCase() + c.kind.slice(1)}: ${c.detail}`;
146
127
  }
147
128
 
148
- const triggersText = formatTriggersGrouped(task.triggers);
129
+ function formatScheduleGrouped(scheduleType: "crons" | "specific_times" | undefined, values: string[] | undefined): string {
130
+ if (!scheduleType || !values || values.length === 0) return "";
131
+ if (values.length === 1) return formatSingleValue(scheduleType, values[0]);
132
+
133
+ const classified = values.map((v) => classifyValue(scheduleType, v));
134
+ const kinds = new Set(classified.map((c) => c.kind));
135
+
136
+ if (kinds.size === 1) {
137
+ const kind = classified[0].kind;
138
+ if (kind === "hourly") return "Every hour";
139
+ const details = classified.map((c) => c.detail);
140
+ return `${kind.charAt(0).toUpperCase() + kind.slice(1)}: ${details.join(", ")}`;
141
+ }
142
+
143
+ return values.map((v) => formatSingleValue(scheduleType, v)).join(", ");
144
+ }
145
+
146
+ const scheduleText = formatScheduleGrouped(task.schedule_type, task.schedule_values);
149
147
 
150
148
  const actionItems = (
151
149
  <>
@@ -174,7 +172,7 @@ export default function TaskCard({ task, lastEvent, onEdit, onDelete, onViewRun
174
172
 
175
173
  return (
176
174
  <>
177
- <div className="task-card" onClick={() => isRunning ? onViewRun(task.id, "latest") : onViewRun(task.id)}>
175
+ <div className="task-card" onClick={() => onViewRun(task.id, "latest")}>
178
176
  <div className="task-card-header">
179
177
  <div className="task-card-title-row">
180
178
  {isRunning ? (
@@ -216,9 +214,9 @@ export default function TaskCard({ task, lastEvent, onEdit, onDelete, onViewRun
216
214
  {" "}{formatTime(lastEvent.time_stamp)}
217
215
  </span>
218
216
  )}
219
- {task.triggers.length > 0 && (
217
+ {task.schedule_type && (task.schedule_values?.length ?? 0) > 0 && (
220
218
  <span className="task-card-triggers">
221
- {task.triggers_enabled ? triggersText : "Triggers disabled"}
219
+ {task.schedule_enabled ? scheduleText : "Schedule disabled"}
222
220
  </span>
223
221
  )}
224
222
  </div>