glad-web 1.0.11 → 1.0.13

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.
@@ -52,6 +52,7 @@ function normalizeJob(input, existing = null, options = {}) {
52
52
  const now = Date.now();
53
53
  const schedule = input.schedule || {};
54
54
  const target = input.target || {};
55
+ const hasStoredNextRunAt = existing && typeof existing.nextRunAt === 'number';
55
56
  const job = {
56
57
  id: existing?.id || input.id || uuidv4(),
57
58
  name: String(input.name || existing?.name || 'Scheduled Task').trim() || 'Scheduled Task',
@@ -73,7 +74,13 @@ function normalizeJob(input, existing = null, options = {}) {
73
74
  lastSessionId: existing?.lastSessionId || input.lastSessionId || null,
74
75
  running: Boolean(existing?.running || false)
75
76
  };
76
- job.nextRunAt = job.enabled ? computeNextRunAt(job.schedule) : null;
77
+
78
+ if (options.recomputeNextRunAt || !hasStoredNextRunAt) {
79
+ job.nextRunAt = job.enabled ? computeNextRunAt(job.schedule, now) : null;
80
+ } else {
81
+ job.nextRunAt = existing.nextRunAt;
82
+ }
83
+
77
84
  return job;
78
85
  }
79
86
 
@@ -102,7 +109,17 @@ class JobStore {
102
109
  const jobs = this.list();
103
110
  const index = jobs.findIndex(job => job.id === id);
104
111
  if (index === -1) return null;
105
- jobs[index] = normalizeJob(input, jobs[index], { touch: true });
112
+ const existing = jobs[index];
113
+ const nextSchedule = {
114
+ time: String(input.schedule?.time || existing.schedule?.time || '09:00'),
115
+ weekdays: normalizeWeekdays(input.schedule?.weekdays ?? existing.schedule?.weekdays ?? [1, 2, 3, 4, 5])
116
+ };
117
+ const scheduleChanged = JSON.stringify(nextSchedule) !== JSON.stringify(existing.schedule);
118
+ const enabledChanged = Boolean(input.enabled ?? existing.enabled ?? true) !== Boolean(existing.enabled);
119
+ jobs[index] = normalizeJob(input, existing, {
120
+ touch: true,
121
+ recomputeNextRunAt: scheduleChanged || enabledChanged
122
+ });
106
123
  this.saveAll(jobs);
107
124
  return jobs[index];
108
125
  }
@@ -835,9 +835,9 @@
835
835
  if (!actionBtn) return;
836
836
 
837
837
  if (toolKey === 'codex') {
838
- actionBtn.dataset.key = 'codex-app';
839
- actionBtn.textContent = '/app';
840
- actionBtn.title = 'Send /app';
838
+ actionBtn.dataset.key = 'codex-perm';
839
+ actionBtn.textContent = '/perm';
840
+ actionBtn.title = 'Send /perm';
841
841
  return;
842
842
  }
843
843
 
@@ -1139,8 +1139,8 @@
1139
1139
  const keyBtn = e.target.closest('.key-btn'); if (!keyBtn) return;
1140
1140
  const key = keyBtn.dataset.key;
1141
1141
  if (key === 'ctrl') { modifiers[key] = !modifiers[key]; keyBtn.classList.toggle('active', modifiers[key]); return; }
1142
- if (key === 'codex-app') {
1143
- sendWS('/app');
1142
+ if (key === 'codex-perm') {
1143
+ sendWS('/perm');
1144
1144
  setTimeout(() => { sendWS('\r'); }, 1000);
1145
1145
  return;
1146
1146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glad-web",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Glad transforms terminal-based AI coding tools into a polished, mobile-friendly local Web interface.",
5
5
  "main": "index.js",
6
6
  "bin": {