capacitor-mobile-claw 2.0.0 → 2.0.1
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.
- package/package.json +1 -1
- package/dist/esm/agent/agent-runner.d.ts +0 -93
- package/dist/esm/agent/agent-runner.d.ts.map +0 -1
- package/dist/esm/agent/agent-runner.js +0 -352
- package/dist/esm/agent/agent-runner.js.map +0 -1
- package/dist/esm/agent/auth-store.d.ts +0 -31
- package/dist/esm/agent/auth-store.d.ts.map +0 -1
- package/dist/esm/agent/auth-store.js +0 -121
- package/dist/esm/agent/auth-store.js.map +0 -1
- package/dist/esm/agent/capacitor-fs-adapter.d.ts +0 -65
- package/dist/esm/agent/capacitor-fs-adapter.d.ts.map +0 -1
- package/dist/esm/agent/capacitor-fs-adapter.js +0 -186
- package/dist/esm/agent/capacitor-fs-adapter.js.map +0 -1
- package/dist/esm/agent/cron-db-access.d.ts +0 -116
- package/dist/esm/agent/cron-db-access.d.ts.map +0 -1
- package/dist/esm/agent/cron-db-access.js +0 -741
- package/dist/esm/agent/cron-db-access.js.map +0 -1
- package/dist/esm/agent/fetch-proxy.d.ts +0 -2
- package/dist/esm/agent/fetch-proxy.d.ts.map +0 -1
- package/dist/esm/agent/fetch-proxy.js +0 -171
- package/dist/esm/agent/fetch-proxy.js.map +0 -1
- package/dist/esm/agent/file-tools.d.ts +0 -17
- package/dist/esm/agent/file-tools.d.ts.map +0 -1
- package/dist/esm/agent/file-tools.js +0 -295
- package/dist/esm/agent/file-tools.js.map +0 -1
- package/dist/esm/agent/git-tools.d.ts +0 -17
- package/dist/esm/agent/git-tools.d.ts.map +0 -1
- package/dist/esm/agent/git-tools.js +0 -184
- package/dist/esm/agent/git-tools.js.map +0 -1
- package/dist/esm/agent/heartbeat-manager.d.ts +0 -63
- package/dist/esm/agent/heartbeat-manager.d.ts.map +0 -1
- package/dist/esm/agent/heartbeat-manager.js +0 -711
- package/dist/esm/agent/heartbeat-manager.js.map +0 -1
- package/dist/esm/agent/retry-logic.d.ts +0 -9
- package/dist/esm/agent/retry-logic.d.ts.map +0 -1
- package/dist/esm/agent/retry-logic.js +0 -30
- package/dist/esm/agent/retry-logic.js.map +0 -1
- package/dist/esm/agent/session-store.d.ts +0 -31
- package/dist/esm/agent/session-store.d.ts.map +0 -1
- package/dist/esm/agent/session-store.js +0 -223
- package/dist/esm/agent/session-store.js.map +0 -1
- package/dist/esm/agent/tool-proxy.d.ts +0 -25
- package/dist/esm/agent/tool-proxy.d.ts.map +0 -1
- package/dist/esm/agent/tool-proxy.js +0 -58
- package/dist/esm/agent/tool-proxy.js.map +0 -1
- package/dist/esm/agent/tool-schemas.d.ts +0 -16
- package/dist/esm/agent/tool-schemas.d.ts.map +0 -1
- package/dist/esm/agent/tool-schemas.js +0 -129
- package/dist/esm/agent/tool-schemas.js.map +0 -1
- package/dist/esm/agent/wasm-tools.d.ts +0 -11
- package/dist/esm/agent/wasm-tools.d.ts.map +0 -1
- package/dist/esm/agent/wasm-tools.js +0 -70
- package/dist/esm/agent/wasm-tools.js.map +0 -1
|
@@ -1,741 +0,0 @@
|
|
|
1
|
-
import { Capacitor } from '@capacitor/core';
|
|
2
|
-
import { CapacitorSQLite, SQLiteConnection } from '@capacitor-community/sqlite';
|
|
3
|
-
const DB_NAME = 'mobile-claw';
|
|
4
|
-
const DB_VERSION = 2;
|
|
5
|
-
export class CronDbAccess {
|
|
6
|
-
sqlite = null;
|
|
7
|
-
db = null;
|
|
8
|
-
initPromise = null;
|
|
9
|
-
async ensureReady() {
|
|
10
|
-
if (this.db)
|
|
11
|
-
return;
|
|
12
|
-
if (this.initPromise) {
|
|
13
|
-
await this.initPromise;
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
this.initPromise = this._init();
|
|
17
|
-
await this.initPromise;
|
|
18
|
-
}
|
|
19
|
-
// ── Connection resilience (mirrors SessionStore) ───────────────────────
|
|
20
|
-
_isStaleConnectionError(err) {
|
|
21
|
-
const msg = String(err?.message || err || '');
|
|
22
|
-
return msg.includes('No available connection') || msg.includes('database is closed');
|
|
23
|
-
}
|
|
24
|
-
async reconnect() {
|
|
25
|
-
console.warn('[CronDbAccess] Reconnecting...');
|
|
26
|
-
this.db = null;
|
|
27
|
-
this.initPromise = null;
|
|
28
|
-
await this.ensureReady();
|
|
29
|
-
}
|
|
30
|
-
async _withRetry(fn) {
|
|
31
|
-
await this.ensureReady();
|
|
32
|
-
try {
|
|
33
|
-
return await fn();
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
if (this._isStaleConnectionError(err)) {
|
|
37
|
-
await this.reconnect();
|
|
38
|
-
return await fn();
|
|
39
|
-
}
|
|
40
|
-
throw err;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
async getSchedulerConfig() {
|
|
44
|
-
await this.ensureReady();
|
|
45
|
-
await this._run(`INSERT OR IGNORE INTO scheduler_config
|
|
46
|
-
(id, enabled, scheduling_mode, run_on_charging, updated_at)
|
|
47
|
-
VALUES (1, 1, 'balanced', 1, ?)`, [Date.now()]);
|
|
48
|
-
const row = await this._queryOne('SELECT * FROM scheduler_config WHERE id = 1');
|
|
49
|
-
return {
|
|
50
|
-
enabled: _toBool(row?.enabled),
|
|
51
|
-
schedulingMode: row?.scheduling_mode || 'balanced',
|
|
52
|
-
runOnCharging: _toBool(row?.run_on_charging),
|
|
53
|
-
globalActiveHours: _mapActiveHours(row?.global_active_hours_start, row?.global_active_hours_end, row?.global_active_hours_tz),
|
|
54
|
-
updatedAt: row?.updated_at ?? undefined,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
async setSchedulerConfig(patch = {}) {
|
|
58
|
-
await this.ensureReady();
|
|
59
|
-
await this.getSchedulerConfig();
|
|
60
|
-
const sets = [];
|
|
61
|
-
const params = [];
|
|
62
|
-
if (patch.enabled !== undefined) {
|
|
63
|
-
sets.push('enabled = ?');
|
|
64
|
-
params.push(_toIntBool(Boolean(patch.enabled)));
|
|
65
|
-
}
|
|
66
|
-
if (patch.schedulingMode !== undefined || patch.scheduling_mode !== undefined) {
|
|
67
|
-
sets.push('scheduling_mode = ?');
|
|
68
|
-
params.push((patch.schedulingMode ?? patch.scheduling_mode) || 'balanced');
|
|
69
|
-
}
|
|
70
|
-
if (patch.runOnCharging !== undefined || patch.run_on_charging !== undefined) {
|
|
71
|
-
sets.push('run_on_charging = ?');
|
|
72
|
-
params.push(_toIntBool(Boolean(patch.runOnCharging ?? patch.run_on_charging)));
|
|
73
|
-
}
|
|
74
|
-
const globalActiveHours = (patch.globalActiveHours || patch.global_active_hours);
|
|
75
|
-
if (globalActiveHours) {
|
|
76
|
-
sets.push('global_active_hours_start = ?');
|
|
77
|
-
params.push(globalActiveHours.start || null);
|
|
78
|
-
sets.push('global_active_hours_end = ?');
|
|
79
|
-
params.push(globalActiveHours.end || null);
|
|
80
|
-
sets.push('global_active_hours_tz = ?');
|
|
81
|
-
params.push(globalActiveHours.tz || globalActiveHours.timezone || null);
|
|
82
|
-
}
|
|
83
|
-
sets.push('updated_at = ?');
|
|
84
|
-
params.push(Date.now());
|
|
85
|
-
params.push(1);
|
|
86
|
-
await this._run(`UPDATE scheduler_config SET ${sets.join(', ')} WHERE id = ?`, params);
|
|
87
|
-
return this.getSchedulerConfig();
|
|
88
|
-
}
|
|
89
|
-
async getHeartbeatConfig() {
|
|
90
|
-
await this.ensureReady();
|
|
91
|
-
await this._run(`INSERT OR IGNORE INTO heartbeat_config
|
|
92
|
-
(id, enabled, every_ms, updated_at)
|
|
93
|
-
VALUES (1, 1, 1800000, ?)`, [Date.now()]);
|
|
94
|
-
const row = await this._queryOne('SELECT * FROM heartbeat_config WHERE id = 1');
|
|
95
|
-
return {
|
|
96
|
-
enabled: _toBool(row?.enabled),
|
|
97
|
-
everyMs: row?.every_ms ?? 1_800_000,
|
|
98
|
-
prompt: row?.prompt || undefined,
|
|
99
|
-
skillId: row?.skill_id || undefined,
|
|
100
|
-
activeHours: _mapActiveHours(row?.active_hours_start, row?.active_hours_end, row?.active_hours_tz),
|
|
101
|
-
nextRunAt: row?.next_run_at ?? undefined,
|
|
102
|
-
lastHash: row?.last_heartbeat_hash || undefined,
|
|
103
|
-
lastSentAt: row?.last_heartbeat_sent_at ?? undefined,
|
|
104
|
-
updatedAt: row?.updated_at ?? undefined,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
async setHeartbeatConfig(patch = {}) {
|
|
108
|
-
await this.ensureReady();
|
|
109
|
-
await this.getHeartbeatConfig();
|
|
110
|
-
const sets = [];
|
|
111
|
-
const params = [];
|
|
112
|
-
if (patch.enabled !== undefined) {
|
|
113
|
-
sets.push('enabled = ?');
|
|
114
|
-
params.push(_toIntBool(Boolean(patch.enabled)));
|
|
115
|
-
}
|
|
116
|
-
if (patch.everyMs !== undefined || patch.every_ms !== undefined) {
|
|
117
|
-
sets.push('every_ms = ?');
|
|
118
|
-
params.push(Number(patch.everyMs ?? patch.every_ms) || 1_800_000);
|
|
119
|
-
}
|
|
120
|
-
if (patch.prompt !== undefined) {
|
|
121
|
-
sets.push('prompt = ?');
|
|
122
|
-
params.push(patch.prompt || null);
|
|
123
|
-
}
|
|
124
|
-
if (patch.skillId !== undefined || patch.skill_id !== undefined) {
|
|
125
|
-
sets.push('skill_id = ?');
|
|
126
|
-
params.push((patch.skillId ?? patch.skill_id) || null);
|
|
127
|
-
}
|
|
128
|
-
const activeHours = (patch.activeHours || patch.active_hours);
|
|
129
|
-
if (activeHours) {
|
|
130
|
-
sets.push('active_hours_start = ?');
|
|
131
|
-
params.push(activeHours.start || null);
|
|
132
|
-
sets.push('active_hours_end = ?');
|
|
133
|
-
params.push(activeHours.end || null);
|
|
134
|
-
sets.push('active_hours_tz = ?');
|
|
135
|
-
params.push(activeHours.tz || activeHours.timezone || null);
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
if (patch.active_hours_start !== undefined) {
|
|
139
|
-
sets.push('active_hours_start = ?');
|
|
140
|
-
params.push(patch.active_hours_start || null);
|
|
141
|
-
}
|
|
142
|
-
if (patch.active_hours_end !== undefined) {
|
|
143
|
-
sets.push('active_hours_end = ?');
|
|
144
|
-
params.push(patch.active_hours_end || null);
|
|
145
|
-
}
|
|
146
|
-
if (patch.active_hours_tz !== undefined) {
|
|
147
|
-
sets.push('active_hours_tz = ?');
|
|
148
|
-
params.push(patch.active_hours_tz || null);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (patch.nextRunAt !== undefined || patch.next_run_at !== undefined) {
|
|
152
|
-
sets.push('next_run_at = ?');
|
|
153
|
-
params.push(patch.nextRunAt ?? patch.next_run_at ?? null);
|
|
154
|
-
}
|
|
155
|
-
if (patch.lastHash !== undefined || patch.last_heartbeat_hash !== undefined) {
|
|
156
|
-
sets.push('last_heartbeat_hash = ?');
|
|
157
|
-
params.push((patch.lastHash ?? patch.last_heartbeat_hash) || null);
|
|
158
|
-
}
|
|
159
|
-
if (patch.lastSentAt !== undefined || patch.last_heartbeat_sent_at !== undefined) {
|
|
160
|
-
sets.push('last_heartbeat_sent_at = ?');
|
|
161
|
-
params.push(patch.lastSentAt ?? patch.last_heartbeat_sent_at ?? null);
|
|
162
|
-
}
|
|
163
|
-
sets.push('updated_at = ?');
|
|
164
|
-
params.push(Date.now());
|
|
165
|
-
params.push(1);
|
|
166
|
-
await this._run(`UPDATE heartbeat_config SET ${sets.join(', ')} WHERE id = ?`, params);
|
|
167
|
-
return this.getHeartbeatConfig();
|
|
168
|
-
}
|
|
169
|
-
async addCronSkill(skill) {
|
|
170
|
-
await this.ensureReady();
|
|
171
|
-
const now = Date.now();
|
|
172
|
-
const id = skill.id || `skill_${now}_${Math.random().toString(36).slice(2, 8)}`;
|
|
173
|
-
await this._run(`INSERT INTO cron_skills
|
|
174
|
-
(id, name, allowed_tools, system_prompt, model, max_turns, timeout_ms, created_at, updated_at)
|
|
175
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
176
|
-
id,
|
|
177
|
-
skill.name,
|
|
178
|
-
skill.allowedTools == null ? null : JSON.stringify(skill.allowedTools),
|
|
179
|
-
skill.systemPrompt || null,
|
|
180
|
-
skill.model || null,
|
|
181
|
-
Number(skill.maxTurns ?? 3),
|
|
182
|
-
Number(skill.timeoutMs ?? 60_000),
|
|
183
|
-
now,
|
|
184
|
-
now,
|
|
185
|
-
]);
|
|
186
|
-
const row = await this._queryOne('SELECT * FROM cron_skills WHERE id = ?', [id]);
|
|
187
|
-
return {
|
|
188
|
-
id: row.id,
|
|
189
|
-
name: row.name,
|
|
190
|
-
allowedTools: _parseJsonArray(row.allowed_tools),
|
|
191
|
-
systemPrompt: row.system_prompt || undefined,
|
|
192
|
-
model: row.model || undefined,
|
|
193
|
-
maxTurns: row.max_turns ?? 3,
|
|
194
|
-
timeoutMs: row.timeout_ms ?? 60_000,
|
|
195
|
-
createdAt: row.created_at,
|
|
196
|
-
updatedAt: row.updated_at,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
async updateCronSkill(id, patch = {}) {
|
|
200
|
-
await this.ensureReady();
|
|
201
|
-
const sets = [];
|
|
202
|
-
const params = [];
|
|
203
|
-
if (patch.name !== undefined) {
|
|
204
|
-
sets.push('name = ?');
|
|
205
|
-
params.push(patch.name);
|
|
206
|
-
}
|
|
207
|
-
if (patch.allowedTools !== undefined || patch.allowed_tools !== undefined) {
|
|
208
|
-
const value = patch.allowedTools ?? patch.allowed_tools;
|
|
209
|
-
sets.push('allowed_tools = ?');
|
|
210
|
-
params.push(value == null ? null : JSON.stringify(value));
|
|
211
|
-
}
|
|
212
|
-
if (patch.systemPrompt !== undefined || patch.system_prompt !== undefined) {
|
|
213
|
-
sets.push('system_prompt = ?');
|
|
214
|
-
params.push((patch.systemPrompt ?? patch.system_prompt) || null);
|
|
215
|
-
}
|
|
216
|
-
if (patch.model !== undefined) {
|
|
217
|
-
sets.push('model = ?');
|
|
218
|
-
params.push(patch.model || null);
|
|
219
|
-
}
|
|
220
|
-
if (patch.maxTurns !== undefined || patch.max_turns !== undefined) {
|
|
221
|
-
sets.push('max_turns = ?');
|
|
222
|
-
params.push(Number(patch.maxTurns ?? patch.max_turns ?? 3));
|
|
223
|
-
}
|
|
224
|
-
if (patch.timeoutMs !== undefined || patch.timeout_ms !== undefined) {
|
|
225
|
-
sets.push('timeout_ms = ?');
|
|
226
|
-
params.push(Number(patch.timeoutMs ?? patch.timeout_ms ?? 60_000));
|
|
227
|
-
}
|
|
228
|
-
sets.push('updated_at = ?');
|
|
229
|
-
params.push(Date.now());
|
|
230
|
-
params.push(id);
|
|
231
|
-
await this._run(`UPDATE cron_skills SET ${sets.join(', ')} WHERE id = ?`, params);
|
|
232
|
-
}
|
|
233
|
-
async removeCronSkill(id) {
|
|
234
|
-
await this.ensureReady();
|
|
235
|
-
await this._run('DELETE FROM cron_skills WHERE id = ?', [id]);
|
|
236
|
-
}
|
|
237
|
-
async listCronSkills() {
|
|
238
|
-
await this.ensureReady();
|
|
239
|
-
const result = await this.db.query('SELECT * FROM cron_skills ORDER BY updated_at DESC');
|
|
240
|
-
return (result.values || []).map((row) => ({
|
|
241
|
-
id: row.id,
|
|
242
|
-
name: row.name,
|
|
243
|
-
allowedTools: _parseJsonArray(row.allowed_tools),
|
|
244
|
-
systemPrompt: row.system_prompt || undefined,
|
|
245
|
-
model: row.model || undefined,
|
|
246
|
-
maxTurns: row.max_turns ?? 3,
|
|
247
|
-
timeoutMs: row.timeout_ms ?? 60_000,
|
|
248
|
-
createdAt: row.created_at,
|
|
249
|
-
updatedAt: row.updated_at,
|
|
250
|
-
}));
|
|
251
|
-
}
|
|
252
|
-
async addCronJob(job) {
|
|
253
|
-
await this.ensureReady();
|
|
254
|
-
const now = Date.now();
|
|
255
|
-
const id = job.id || `job_${now}_${Math.random().toString(36).slice(2, 8)}`;
|
|
256
|
-
const schedule = job.schedule || {};
|
|
257
|
-
const activeHours = job.activeHours || {};
|
|
258
|
-
let nextRunAt = job.nextRunAt ?? null;
|
|
259
|
-
if (nextRunAt === null || nextRunAt === undefined) {
|
|
260
|
-
if (schedule.kind === 'at')
|
|
261
|
-
nextRunAt = Number(schedule.atMs) || null;
|
|
262
|
-
else if (schedule.kind === 'every') {
|
|
263
|
-
const everyMs = Number(schedule.everyMs) || 0;
|
|
264
|
-
nextRunAt = everyMs > 0 ? now + everyMs : null;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
await this._run(`INSERT INTO cron_jobs
|
|
268
|
-
(id, name, enabled, session_target, wake_mode, schedule_kind, schedule_every_ms, schedule_anchor_ms, schedule_at_ms,
|
|
269
|
-
skill_id, prompt, delivery_mode, delivery_webhook_url, delivery_notification_title,
|
|
270
|
-
active_hours_start, active_hours_end, active_hours_tz,
|
|
271
|
-
last_run_at, next_run_at, last_run_status, last_error, last_duration_ms,
|
|
272
|
-
last_response_hash, last_response_sent_at, consecutive_errors, created_at, updated_at)
|
|
273
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
274
|
-
id,
|
|
275
|
-
job.name,
|
|
276
|
-
_toIntBool(job.enabled !== false),
|
|
277
|
-
job.sessionTarget || 'isolated',
|
|
278
|
-
job.wakeMode || 'next-heartbeat',
|
|
279
|
-
schedule.kind ?? null,
|
|
280
|
-
schedule.kind === 'every' ? Number(schedule.everyMs) || null : null,
|
|
281
|
-
Number(schedule.anchorMs) || null,
|
|
282
|
-
schedule.kind === 'at' ? Number(schedule.atMs) || null : null,
|
|
283
|
-
job.skillId || null,
|
|
284
|
-
job.prompt || '',
|
|
285
|
-
job.deliveryMode || 'notification',
|
|
286
|
-
job.deliveryWebhookUrl || null,
|
|
287
|
-
job.deliveryNotificationTitle || null,
|
|
288
|
-
activeHours.start || null,
|
|
289
|
-
activeHours.end || null,
|
|
290
|
-
activeHours.tz || activeHours.timezone || null,
|
|
291
|
-
null,
|
|
292
|
-
nextRunAt,
|
|
293
|
-
null,
|
|
294
|
-
null,
|
|
295
|
-
null,
|
|
296
|
-
null,
|
|
297
|
-
null,
|
|
298
|
-
0,
|
|
299
|
-
now,
|
|
300
|
-
now,
|
|
301
|
-
]);
|
|
302
|
-
const row = await this._queryOne('SELECT * FROM cron_jobs WHERE id = ?', [id]);
|
|
303
|
-
return _toCronJobRecord(row);
|
|
304
|
-
}
|
|
305
|
-
async removeCronJob(id) {
|
|
306
|
-
await this.ensureReady();
|
|
307
|
-
await this._run('DELETE FROM cron_jobs WHERE id = ?', [id]);
|
|
308
|
-
await this._run('DELETE FROM cron_runs WHERE job_id = ?', [id]);
|
|
309
|
-
}
|
|
310
|
-
async listCronJobs() {
|
|
311
|
-
await this.ensureReady();
|
|
312
|
-
const result = await this.db.query('SELECT * FROM cron_jobs ORDER BY updated_at DESC');
|
|
313
|
-
return (result.values || []).map((row) => _toCronJobRecord(row));
|
|
314
|
-
}
|
|
315
|
-
async getDueJobs(nowMs = Date.now()) {
|
|
316
|
-
await this.ensureReady();
|
|
317
|
-
const result = await this.db.query(`SELECT * FROM cron_jobs
|
|
318
|
-
WHERE enabled = 1
|
|
319
|
-
AND next_run_at IS NOT NULL
|
|
320
|
-
AND next_run_at <= ?
|
|
321
|
-
ORDER BY next_run_at ASC`, [nowMs]);
|
|
322
|
-
return (result.values || []).map((row) => _toCronJobRecord(row));
|
|
323
|
-
}
|
|
324
|
-
async updateCronJob(id, patch = {}) {
|
|
325
|
-
await this.ensureReady();
|
|
326
|
-
const sets = [];
|
|
327
|
-
const params = [];
|
|
328
|
-
if (patch.name !== undefined) {
|
|
329
|
-
sets.push('name = ?');
|
|
330
|
-
params.push(patch.name);
|
|
331
|
-
}
|
|
332
|
-
if (patch.enabled !== undefined) {
|
|
333
|
-
sets.push('enabled = ?');
|
|
334
|
-
params.push(_toIntBool(Boolean(patch.enabled)));
|
|
335
|
-
}
|
|
336
|
-
if (patch.sessionTarget !== undefined || patch.session_target !== undefined) {
|
|
337
|
-
sets.push('session_target = ?');
|
|
338
|
-
params.push((patch.sessionTarget ?? patch.session_target) || 'isolated');
|
|
339
|
-
}
|
|
340
|
-
if (patch.wakeMode !== undefined || patch.wake_mode !== undefined) {
|
|
341
|
-
sets.push('wake_mode = ?');
|
|
342
|
-
params.push((patch.wakeMode ?? patch.wake_mode) || 'next-heartbeat');
|
|
343
|
-
}
|
|
344
|
-
const schedule = patch.schedule;
|
|
345
|
-
if (schedule) {
|
|
346
|
-
if (schedule.kind !== undefined) {
|
|
347
|
-
sets.push('schedule_kind = ?');
|
|
348
|
-
params.push(schedule.kind);
|
|
349
|
-
}
|
|
350
|
-
if (schedule.everyMs !== undefined || schedule.every_ms !== undefined) {
|
|
351
|
-
sets.push('schedule_every_ms = ?');
|
|
352
|
-
params.push(Number(schedule.everyMs ?? schedule.every_ms) || null);
|
|
353
|
-
}
|
|
354
|
-
if (schedule.anchorMs !== undefined || schedule.anchor_ms !== undefined) {
|
|
355
|
-
sets.push('schedule_anchor_ms = ?');
|
|
356
|
-
params.push(Number(schedule.anchorMs ?? schedule.anchor_ms) || null);
|
|
357
|
-
}
|
|
358
|
-
if (schedule.atMs !== undefined || schedule.at_ms !== undefined) {
|
|
359
|
-
sets.push('schedule_at_ms = ?');
|
|
360
|
-
params.push(Number(schedule.atMs ?? schedule.at_ms) || null);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
else {
|
|
364
|
-
if (patch.scheduleKind !== undefined || patch.schedule_kind !== undefined) {
|
|
365
|
-
sets.push('schedule_kind = ?');
|
|
366
|
-
params.push(patch.scheduleKind ?? patch.schedule_kind);
|
|
367
|
-
}
|
|
368
|
-
if (patch.scheduleEveryMs !== undefined || patch.schedule_every_ms !== undefined) {
|
|
369
|
-
sets.push('schedule_every_ms = ?');
|
|
370
|
-
params.push(Number(patch.scheduleEveryMs ?? patch.schedule_every_ms) || null);
|
|
371
|
-
}
|
|
372
|
-
if (patch.scheduleAnchorMs !== undefined || patch.schedule_anchor_ms !== undefined) {
|
|
373
|
-
sets.push('schedule_anchor_ms = ?');
|
|
374
|
-
params.push(Number(patch.scheduleAnchorMs ?? patch.schedule_anchor_ms) || null);
|
|
375
|
-
}
|
|
376
|
-
if (patch.scheduleAtMs !== undefined || patch.schedule_at_ms !== undefined) {
|
|
377
|
-
sets.push('schedule_at_ms = ?');
|
|
378
|
-
params.push(Number(patch.scheduleAtMs ?? patch.schedule_at_ms) || null);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
if (patch.skillId !== undefined || patch.skill_id !== undefined) {
|
|
382
|
-
sets.push('skill_id = ?');
|
|
383
|
-
params.push((patch.skillId ?? patch.skill_id) || null);
|
|
384
|
-
}
|
|
385
|
-
if (patch.prompt !== undefined) {
|
|
386
|
-
sets.push('prompt = ?');
|
|
387
|
-
params.push(patch.prompt || '');
|
|
388
|
-
}
|
|
389
|
-
if (patch.deliveryMode !== undefined || patch.delivery_mode !== undefined) {
|
|
390
|
-
sets.push('delivery_mode = ?');
|
|
391
|
-
params.push((patch.deliveryMode ?? patch.delivery_mode) || 'notification');
|
|
392
|
-
}
|
|
393
|
-
if (patch.deliveryWebhookUrl !== undefined || patch.delivery_webhook_url !== undefined) {
|
|
394
|
-
sets.push('delivery_webhook_url = ?');
|
|
395
|
-
params.push((patch.deliveryWebhookUrl ?? patch.delivery_webhook_url) || null);
|
|
396
|
-
}
|
|
397
|
-
if (patch.deliveryNotificationTitle !== undefined || patch.delivery_notification_title !== undefined) {
|
|
398
|
-
sets.push('delivery_notification_title = ?');
|
|
399
|
-
params.push((patch.deliveryNotificationTitle ?? patch.delivery_notification_title) || null);
|
|
400
|
-
}
|
|
401
|
-
const activeHours = (patch.activeHours || patch.active_hours);
|
|
402
|
-
if (activeHours) {
|
|
403
|
-
sets.push('active_hours_start = ?');
|
|
404
|
-
params.push(activeHours.start || null);
|
|
405
|
-
sets.push('active_hours_end = ?');
|
|
406
|
-
params.push(activeHours.end || null);
|
|
407
|
-
sets.push('active_hours_tz = ?');
|
|
408
|
-
params.push(activeHours.tz || activeHours.timezone || null);
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
if (patch.active_hours_start !== undefined) {
|
|
412
|
-
sets.push('active_hours_start = ?');
|
|
413
|
-
params.push(patch.active_hours_start || null);
|
|
414
|
-
}
|
|
415
|
-
if (patch.active_hours_end !== undefined) {
|
|
416
|
-
sets.push('active_hours_end = ?');
|
|
417
|
-
params.push(patch.active_hours_end || null);
|
|
418
|
-
}
|
|
419
|
-
if (patch.active_hours_tz !== undefined) {
|
|
420
|
-
sets.push('active_hours_tz = ?');
|
|
421
|
-
params.push(patch.active_hours_tz || null);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
if (patch.lastRunAt !== undefined || patch.last_run_at !== undefined) {
|
|
425
|
-
sets.push('last_run_at = ?');
|
|
426
|
-
params.push(patch.lastRunAt ?? patch.last_run_at ?? null);
|
|
427
|
-
}
|
|
428
|
-
if (patch.nextRunAt !== undefined || patch.next_run_at !== undefined) {
|
|
429
|
-
sets.push('next_run_at = ?');
|
|
430
|
-
params.push(patch.nextRunAt ?? patch.next_run_at ?? null);
|
|
431
|
-
}
|
|
432
|
-
if (patch.lastRunStatus !== undefined || patch.last_run_status !== undefined) {
|
|
433
|
-
sets.push('last_run_status = ?');
|
|
434
|
-
params.push((patch.lastRunStatus ?? patch.last_run_status) || null);
|
|
435
|
-
}
|
|
436
|
-
if (patch.lastError !== undefined || patch.last_error !== undefined) {
|
|
437
|
-
sets.push('last_error = ?');
|
|
438
|
-
params.push((patch.lastError ?? patch.last_error) || null);
|
|
439
|
-
}
|
|
440
|
-
if (patch.lastDurationMs !== undefined || patch.last_duration_ms !== undefined) {
|
|
441
|
-
sets.push('last_duration_ms = ?');
|
|
442
|
-
params.push(patch.lastDurationMs ?? patch.last_duration_ms ?? null);
|
|
443
|
-
}
|
|
444
|
-
if (patch.lastResponseHash !== undefined || patch.last_response_hash !== undefined) {
|
|
445
|
-
sets.push('last_response_hash = ?');
|
|
446
|
-
params.push((patch.lastResponseHash ?? patch.last_response_hash) || null);
|
|
447
|
-
}
|
|
448
|
-
if (patch.lastResponseSentAt !== undefined || patch.last_response_sent_at !== undefined) {
|
|
449
|
-
sets.push('last_response_sent_at = ?');
|
|
450
|
-
params.push(patch.lastResponseSentAt ?? patch.last_response_sent_at ?? null);
|
|
451
|
-
}
|
|
452
|
-
if (patch.consecutiveErrors !== undefined || patch.consecutive_errors !== undefined) {
|
|
453
|
-
sets.push('consecutive_errors = ?');
|
|
454
|
-
params.push(Number(patch.consecutiveErrors ?? patch.consecutive_errors) || 0);
|
|
455
|
-
}
|
|
456
|
-
sets.push('updated_at = ?');
|
|
457
|
-
params.push(Date.now());
|
|
458
|
-
params.push(id);
|
|
459
|
-
await this._run(`UPDATE cron_jobs SET ${sets.join(', ')} WHERE id = ?`, params);
|
|
460
|
-
}
|
|
461
|
-
async insertCronRun(runData) {
|
|
462
|
-
await this.ensureReady();
|
|
463
|
-
await this._run(`INSERT INTO cron_runs
|
|
464
|
-
(job_id, started_at, ended_at, status, duration_ms, error, response_text, was_heartbeat_ok, was_deduped, delivered, wake_source)
|
|
465
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
466
|
-
runData.jobId,
|
|
467
|
-
runData.startedAt,
|
|
468
|
-
runData.endedAt ?? null,
|
|
469
|
-
runData.status ?? null,
|
|
470
|
-
runData.durationMs ?? null,
|
|
471
|
-
runData.error ?? null,
|
|
472
|
-
runData.responseText ?? null,
|
|
473
|
-
_toIntBool(Boolean(runData.wasHeartbeatOk)),
|
|
474
|
-
_toIntBool(Boolean(runData.wasDeduped)),
|
|
475
|
-
_toIntBool(Boolean(runData.delivered)),
|
|
476
|
-
runData.wakeSource ?? null,
|
|
477
|
-
]);
|
|
478
|
-
const row = await this._queryOne('SELECT last_insert_rowid() as id');
|
|
479
|
-
return row?.id ?? null;
|
|
480
|
-
}
|
|
481
|
-
async listCronRuns(opts = {}) {
|
|
482
|
-
await this.ensureReady();
|
|
483
|
-
const limit = opts.limit || 100;
|
|
484
|
-
if (opts.jobId) {
|
|
485
|
-
const result = await this.db.query('SELECT * FROM cron_runs WHERE job_id = ? ORDER BY started_at DESC LIMIT ?', [
|
|
486
|
-
opts.jobId,
|
|
487
|
-
limit,
|
|
488
|
-
]);
|
|
489
|
-
return (result.values || []).map(_toCronRunRecord);
|
|
490
|
-
}
|
|
491
|
-
const result = await this.db.query('SELECT * FROM cron_runs ORDER BY started_at DESC LIMIT ?', [limit]);
|
|
492
|
-
return (result.values || []).map(_toCronRunRecord);
|
|
493
|
-
}
|
|
494
|
-
async peekPendingEvents(sessionKey) {
|
|
495
|
-
await this.ensureReady();
|
|
496
|
-
const result = await this.db.query(`SELECT id, session_key, context_key, text, created_at, consumed
|
|
497
|
-
FROM system_events
|
|
498
|
-
WHERE session_key = ? AND consumed = 0
|
|
499
|
-
ORDER BY created_at ASC, id ASC`, [sessionKey]);
|
|
500
|
-
return (result.values || []).map((row) => ({
|
|
501
|
-
id: row.id,
|
|
502
|
-
sessionKey: row.session_key,
|
|
503
|
-
contextKey: row.context_key || undefined,
|
|
504
|
-
text: row.text,
|
|
505
|
-
createdAt: row.created_at,
|
|
506
|
-
consumed: _toBool(row.consumed),
|
|
507
|
-
}));
|
|
508
|
-
}
|
|
509
|
-
async consumePendingEvents(ids) {
|
|
510
|
-
await this.ensureReady();
|
|
511
|
-
if (!ids.length)
|
|
512
|
-
return;
|
|
513
|
-
const placeholders = ids.map(() => '?').join(', ');
|
|
514
|
-
await this._run(`UPDATE system_events SET consumed = 1 WHERE id IN (${placeholders})`, ids);
|
|
515
|
-
}
|
|
516
|
-
async enqueueSystemEvent(sessionKey, contextKey, text) {
|
|
517
|
-
await this.ensureReady();
|
|
518
|
-
await this._run(`INSERT INTO system_events
|
|
519
|
-
(session_key, context_key, text, created_at, consumed)
|
|
520
|
-
VALUES (?, ?, ?, ?, 0)`, [sessionKey, contextKey || null, text, Date.now()]);
|
|
521
|
-
}
|
|
522
|
-
async getMaxMessageSequence(sessionKey) {
|
|
523
|
-
await this.ensureReady();
|
|
524
|
-
const row = await this._queryOne('SELECT MAX(sequence) as max_seq FROM messages WHERE session_key = ?', [
|
|
525
|
-
sessionKey,
|
|
526
|
-
]);
|
|
527
|
-
return Number.isFinite(row?.max_seq) ? row.max_seq : -1;
|
|
528
|
-
}
|
|
529
|
-
async deleteMessagesAfter(sessionKey, sequence) {
|
|
530
|
-
await this.ensureReady();
|
|
531
|
-
await this._run('DELETE FROM messages WHERE session_key = ? AND sequence > ?', [sessionKey, sequence]);
|
|
532
|
-
}
|
|
533
|
-
async _init() {
|
|
534
|
-
this.sqlite = new SQLiteConnection(CapacitorSQLite);
|
|
535
|
-
if (Capacitor.getPlatform() === 'web') {
|
|
536
|
-
if (!document.querySelector('jeep-sqlite')) {
|
|
537
|
-
const el = document.createElement('jeep-sqlite');
|
|
538
|
-
document.body.appendChild(el);
|
|
539
|
-
}
|
|
540
|
-
await customElements.whenDefined('jeep-sqlite');
|
|
541
|
-
await this.sqlite.initWebStore();
|
|
542
|
-
}
|
|
543
|
-
// Force-close any stale connection before creating a fresh one.
|
|
544
|
-
// checkConnectionsConsistency() can invalidate the native handle while
|
|
545
|
-
// the JS wrapper still reports isConnection=true, leading to
|
|
546
|
-
// "No available connection for database mobile-claw" errors.
|
|
547
|
-
await this.sqlite.checkConnectionsConsistency();
|
|
548
|
-
const isConn = await this.sqlite.isConnection(DB_NAME, false);
|
|
549
|
-
if (isConn.result) {
|
|
550
|
-
try {
|
|
551
|
-
await this.sqlite.closeConnection(DB_NAME, false);
|
|
552
|
-
}
|
|
553
|
-
catch {
|
|
554
|
-
/* already closed */
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
this.db = await this.sqlite.createConnection(DB_NAME, false, 'no-encryption', DB_VERSION, false);
|
|
558
|
-
await this.db.open();
|
|
559
|
-
// Ensure schema exists (tables may not exist on a fresh install)
|
|
560
|
-
await this.db.execute(`
|
|
561
|
-
CREATE TABLE IF NOT EXISTS scheduler_config (
|
|
562
|
-
id INTEGER PRIMARY KEY,
|
|
563
|
-
enabled INTEGER NOT NULL DEFAULT 1,
|
|
564
|
-
scheduling_mode TEXT NOT NULL DEFAULT 'balanced',
|
|
565
|
-
run_on_charging INTEGER NOT NULL DEFAULT 1,
|
|
566
|
-
global_active_hours_start TEXT,
|
|
567
|
-
global_active_hours_end TEXT,
|
|
568
|
-
global_active_hours_tz TEXT,
|
|
569
|
-
updated_at INTEGER
|
|
570
|
-
);
|
|
571
|
-
|
|
572
|
-
CREATE TABLE IF NOT EXISTS heartbeat_config (
|
|
573
|
-
id INTEGER PRIMARY KEY,
|
|
574
|
-
enabled INTEGER NOT NULL DEFAULT 0,
|
|
575
|
-
every_ms INTEGER NOT NULL DEFAULT 1800000,
|
|
576
|
-
prompt TEXT,
|
|
577
|
-
skill_id TEXT,
|
|
578
|
-
active_hours_start TEXT,
|
|
579
|
-
active_hours_end TEXT,
|
|
580
|
-
active_hours_tz TEXT,
|
|
581
|
-
next_run_at INTEGER,
|
|
582
|
-
last_heartbeat_hash TEXT,
|
|
583
|
-
last_heartbeat_sent_at INTEGER,
|
|
584
|
-
updated_at INTEGER
|
|
585
|
-
);
|
|
586
|
-
|
|
587
|
-
CREATE TABLE IF NOT EXISTS cron_skills (
|
|
588
|
-
id TEXT PRIMARY KEY,
|
|
589
|
-
name TEXT NOT NULL,
|
|
590
|
-
allowed_tools TEXT,
|
|
591
|
-
system_prompt TEXT,
|
|
592
|
-
model TEXT,
|
|
593
|
-
max_turns INTEGER NOT NULL DEFAULT 3,
|
|
594
|
-
timeout_ms INTEGER NOT NULL DEFAULT 60000,
|
|
595
|
-
created_at INTEGER NOT NULL,
|
|
596
|
-
updated_at INTEGER NOT NULL
|
|
597
|
-
);
|
|
598
|
-
|
|
599
|
-
CREATE TABLE IF NOT EXISTS cron_jobs (
|
|
600
|
-
id TEXT PRIMARY KEY,
|
|
601
|
-
name TEXT NOT NULL,
|
|
602
|
-
enabled INTEGER NOT NULL DEFAULT 1,
|
|
603
|
-
session_target TEXT NOT NULL DEFAULT 'isolated',
|
|
604
|
-
wake_mode TEXT NOT NULL DEFAULT 'next-heartbeat',
|
|
605
|
-
schedule_kind TEXT,
|
|
606
|
-
schedule_every_ms INTEGER,
|
|
607
|
-
schedule_anchor_ms INTEGER,
|
|
608
|
-
schedule_at_ms INTEGER,
|
|
609
|
-
skill_id TEXT,
|
|
610
|
-
prompt TEXT,
|
|
611
|
-
delivery_mode TEXT NOT NULL DEFAULT 'notification',
|
|
612
|
-
delivery_webhook_url TEXT,
|
|
613
|
-
delivery_notification_title TEXT,
|
|
614
|
-
active_hours_start TEXT,
|
|
615
|
-
active_hours_end TEXT,
|
|
616
|
-
active_hours_tz TEXT,
|
|
617
|
-
last_run_at INTEGER,
|
|
618
|
-
next_run_at INTEGER,
|
|
619
|
-
last_run_status TEXT,
|
|
620
|
-
last_error TEXT,
|
|
621
|
-
last_duration_ms INTEGER,
|
|
622
|
-
last_response_hash TEXT,
|
|
623
|
-
last_response_sent_at INTEGER,
|
|
624
|
-
consecutive_errors INTEGER NOT NULL DEFAULT 0,
|
|
625
|
-
created_at INTEGER NOT NULL,
|
|
626
|
-
updated_at INTEGER NOT NULL
|
|
627
|
-
);
|
|
628
|
-
|
|
629
|
-
CREATE TABLE IF NOT EXISTS cron_runs (
|
|
630
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
631
|
-
job_id TEXT NOT NULL,
|
|
632
|
-
started_at INTEGER NOT NULL,
|
|
633
|
-
ended_at INTEGER,
|
|
634
|
-
status TEXT,
|
|
635
|
-
duration_ms INTEGER,
|
|
636
|
-
error TEXT,
|
|
637
|
-
response_text TEXT,
|
|
638
|
-
was_heartbeat_ok INTEGER NOT NULL DEFAULT 0,
|
|
639
|
-
was_deduped INTEGER NOT NULL DEFAULT 0,
|
|
640
|
-
delivered INTEGER NOT NULL DEFAULT 0,
|
|
641
|
-
wake_source TEXT
|
|
642
|
-
);
|
|
643
|
-
|
|
644
|
-
CREATE TABLE IF NOT EXISTS system_events (
|
|
645
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
646
|
-
session_key TEXT NOT NULL,
|
|
647
|
-
context_key TEXT,
|
|
648
|
-
text TEXT NOT NULL,
|
|
649
|
-
created_at INTEGER NOT NULL,
|
|
650
|
-
consumed INTEGER NOT NULL DEFAULT 0
|
|
651
|
-
);
|
|
652
|
-
|
|
653
|
-
CREATE INDEX IF NOT EXISTS idx_cron_runs_job ON cron_runs(job_id);
|
|
654
|
-
CREATE INDEX IF NOT EXISTS idx_system_events_session ON system_events(session_key, consumed);
|
|
655
|
-
`, false);
|
|
656
|
-
}
|
|
657
|
-
async _run(sql, params = []) {
|
|
658
|
-
return this._withRetry(async () => {
|
|
659
|
-
await this.db.run(sql, params, true);
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
async _queryOne(sql, params = []) {
|
|
663
|
-
return this._withRetry(async () => {
|
|
664
|
-
const result = await this.db.query(sql, params);
|
|
665
|
-
return result.values?.[0] ?? null;
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
function _toBool(value) {
|
|
670
|
-
return Number(value) === 1;
|
|
671
|
-
}
|
|
672
|
-
function _toIntBool(value) {
|
|
673
|
-
return value ? 1 : 0;
|
|
674
|
-
}
|
|
675
|
-
function _parseJsonArray(value) {
|
|
676
|
-
if (!value)
|
|
677
|
-
return undefined;
|
|
678
|
-
try {
|
|
679
|
-
const parsed = JSON.parse(value);
|
|
680
|
-
return Array.isArray(parsed) ? parsed : undefined;
|
|
681
|
-
}
|
|
682
|
-
catch {
|
|
683
|
-
return undefined;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
function _mapActiveHours(start, end, tz) {
|
|
687
|
-
if (!start && !end && !tz)
|
|
688
|
-
return undefined;
|
|
689
|
-
return {
|
|
690
|
-
...(start ? { start } : {}),
|
|
691
|
-
...(end ? { end } : {}),
|
|
692
|
-
...(tz ? { tz } : {}),
|
|
693
|
-
};
|
|
694
|
-
}
|
|
695
|
-
function _toCronJobRecord(row) {
|
|
696
|
-
return {
|
|
697
|
-
id: row.id,
|
|
698
|
-
name: row.name,
|
|
699
|
-
enabled: _toBool(row.enabled),
|
|
700
|
-
sessionTarget: row.session_target || 'isolated',
|
|
701
|
-
wakeMode: row.wake_mode || 'next-heartbeat',
|
|
702
|
-
schedule: {
|
|
703
|
-
kind: row.schedule_kind,
|
|
704
|
-
everyMs: row.schedule_every_ms ?? undefined,
|
|
705
|
-
atMs: row.schedule_at_ms ?? undefined,
|
|
706
|
-
},
|
|
707
|
-
skillId: row.skill_id,
|
|
708
|
-
prompt: row.prompt,
|
|
709
|
-
deliveryMode: row.delivery_mode || 'notification',
|
|
710
|
-
deliveryWebhookUrl: row.delivery_webhook_url || undefined,
|
|
711
|
-
deliveryNotificationTitle: row.delivery_notification_title || undefined,
|
|
712
|
-
activeHours: _mapActiveHours(row.active_hours_start, row.active_hours_end, row.active_hours_tz),
|
|
713
|
-
lastRunAt: row.last_run_at ?? undefined,
|
|
714
|
-
nextRunAt: row.next_run_at ?? undefined,
|
|
715
|
-
lastRunStatus: row.last_run_status || undefined,
|
|
716
|
-
lastError: row.last_error || undefined,
|
|
717
|
-
lastDurationMs: row.last_duration_ms ?? undefined,
|
|
718
|
-
lastResponseHash: row.last_response_hash || undefined,
|
|
719
|
-
lastResponseSentAt: row.last_response_sent_at ?? undefined,
|
|
720
|
-
consecutiveErrors: row.consecutive_errors ?? 0,
|
|
721
|
-
createdAt: row.created_at,
|
|
722
|
-
updatedAt: row.updated_at,
|
|
723
|
-
};
|
|
724
|
-
}
|
|
725
|
-
function _toCronRunRecord(row) {
|
|
726
|
-
return {
|
|
727
|
-
id: row.id,
|
|
728
|
-
jobId: row.job_id,
|
|
729
|
-
startedAt: row.started_at,
|
|
730
|
-
endedAt: row.ended_at ?? null,
|
|
731
|
-
status: row.status ?? null,
|
|
732
|
-
durationMs: row.duration_ms ?? null,
|
|
733
|
-
error: row.error ?? null,
|
|
734
|
-
responseText: row.response_text ?? null,
|
|
735
|
-
wasHeartbeatOk: _toBool(row.was_heartbeat_ok),
|
|
736
|
-
wasDeduped: _toBool(row.was_deduped),
|
|
737
|
-
delivered: _toBool(row.delivered),
|
|
738
|
-
wakeSource: row.wake_source ?? null,
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
//# sourceMappingURL=cron-db-access.js.map
|