@goodandready/dsh-cron 0.3.31 → 0.3.33

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.
@@ -232,6 +232,14 @@ export async function handleCompleteRun(scheduler, task, taskId, currentRun, out
232
232
  const finishedRun = scheduler.running.get(taskId);
233
233
  const isCurrentRun = (finishedRun === currentRun);
234
234
  if (isCurrentRun) scheduler.running.delete(taskId);
235
+ if (scheduler.scopeLocks) {
236
+ scheduler.scopeLocks.release(task, taskId);
237
+ }
238
+ if (outcome && (outcome.status === 'ok' || outcome.status === 'success') && options && options.currentInputHash) {
239
+ try {
240
+ scheduler.store.patch(taskId, { lastInputHash: options.currentInputHash });
241
+ } catch (_hashErr) { void _hashErr; }
242
+ }
235
243
  const queuedRuns = isCurrentRun ? (finishedRun?.queuedRuns || []) : [];
236
244
  const queuedCount = isCurrentRun ? (finishedRun?.queueCount || 0) : 0;
237
245
 
@@ -249,40 +257,8 @@ export async function handleCompleteRun(scheduler, task, taskId, currentRun, out
249
257
  const guard = await checkAndApplyBurnGuard(scheduler, taskId, outcome);
250
258
  if (guard && guard.exceeded) return;
251
259
 
252
- if (!scheduler.isStopped && scheduler.queue.length > 0 && (scheduler.maxConcurrent === 0 || scheduler.running.size < scheduler.maxConcurrent)) {
253
- let admittedIndex = -1;
254
- for (let i = 0; i < scheduler.queue.length; i++) {
255
- const candidate = scheduler.queue[i];
256
- const queuedTask = scheduler.store.get(candidate.taskId);
257
- if (!queuedTask || queuedTask.status !== 'active') {
258
- scheduler.queue.splice(i, 1);
259
- i--;
260
- continue;
261
- }
262
- const qGroup = queuedTask.concurrencyGroup && queuedTask.concurrencyGroup !== 'default'
263
- ? String(queuedTask.concurrencyGroup).trim()
264
- : null;
265
- const qLimit = scheduler.getGroupLimit ? scheduler.getGroupLimit(qGroup) : (qGroup ? 1 : 0);
266
- if (qGroup && qLimit > 0) {
267
- const inGroup = scheduler.getRunningGroupCount ? scheduler.getRunningGroupCount(qGroup) : 0;
268
- if (inGroup >= qLimit) {
269
- continue;
270
- }
271
- }
272
- admittedIndex = i;
273
- break;
274
- }
275
-
276
- if (admittedIndex !== -1) {
277
- const nextItem = scheduler.queue.splice(admittedIndex, 1)[0];
278
- setImmediate(() => {
279
- if (!scheduler.isStopped) {
280
- scheduler.runTask(nextItem.taskId, nextItem.options || {}).catch((runErr) => {
281
- bestEffort('drain-queued-task', () => {}, scheduler.logger);
282
- });
283
- }
284
- });
285
- }
260
+ if (typeof scheduler.drainQueue === 'function') {
261
+ scheduler.drainQueue();
286
262
  }
287
263
 
288
264
  // 1. Structured LLM Actions (#137)
@@ -4,6 +4,7 @@ import { globalBudgetManager } from '../global-budgets.js';
4
4
  import { logger } from '../logger.js';
5
5
  import { checkAndApplyBurnGuard, checkTaskBudgetLimits } from '../burn-guard.js';
6
6
  import { resolveTaskForExecution } from '../prompt-interpolation.js';
7
+ import { computeTaskInputHash } from '../input-hash.js';
7
8
  import { approvalManager } from '../approval.js';
8
9
  import {
9
10
  AGENT_TASK_TYPES,
@@ -79,6 +80,28 @@ export function beginRun(scheduler, task, taskId, options = {}) {
79
80
  }
80
81
  }
81
82
 
83
+ if (scheduler.scopeLocks && !scheduler.running.has(taskId)) {
84
+ const scopeCheck = scheduler.scopeLocks.canAcquire(task, taskId);
85
+ if (!scopeCheck.ok) {
86
+ const conflictMsg = `Scope conflict with task "${scopeCheck.conflictTaskId}" on "${scopeCheck.conflictingScope}"`;
87
+ if (task.overlapPolicy === 'queue') {
88
+ logger.info(`[dsh-cron] Task "${task.title}" (${taskId}) queued by ${conflictMsg}`);
89
+ scheduler.queue.push({
90
+ taskId,
91
+ options: { ...options },
92
+ priority: task.priority !== undefined ? task.priority : 5,
93
+ queuedAt: Date.now(),
94
+ waitReason: 'scope-conflict',
95
+ });
96
+ scheduler.queue.sort((a, b) => (a.priority - b.priority) || (a.queuedAt - b.queuedAt));
97
+ return null;
98
+ }
99
+ logger.info(`[dsh-cron] Task "${task.title}" (${taskId}) skipped: ${conflictMsg}`);
100
+ scheduler.recordSkipped(taskId, `Skipped: ${conflictMsg}`);
101
+ return null;
102
+ }
103
+ }
104
+
82
105
  const overlapPolicy = task.overlapPolicy || 'skip';
83
106
  const active = scheduler.running.get(taskId);
84
107
  if (active) {
@@ -112,6 +135,9 @@ export function beginRun(scheduler, task, taskId, options = {}) {
112
135
  concurrencyGroup: group || 'default',
113
136
  };
114
137
  scheduler.running.set(taskId, currentRun);
138
+ if (scheduler.scopeLocks) {
139
+ scheduler.scopeLocks.acquire(task, taskId);
140
+ }
115
141
  return currentRun;
116
142
  }
117
143
 
@@ -225,13 +251,37 @@ export async function executeTask(scheduler, taskId, options = {}) {
225
251
  const currentRun = scheduler.beginRun(task, taskId, options);
226
252
  if (currentRun === null) return null;
227
253
 
254
+ // Input Hash check (#408): skip execution if input files are unchanged
255
+ const rawInputPaths = task.inputHashPaths;
256
+ const hasInputCheck = (Array.isArray(rawInputPaths) ? rawInputPaths.length > 0 : Boolean(rawInputPaths)) || task.skipIfUnchanged;
257
+ if (hasInputCheck && !options.dryRun && !options.forceRun) {
258
+ const cwd = scheduler.runner?.resolveCwd ? scheduler.runner.resolveCwd(task, scheduler.ctx) : (task.cwd || process.cwd());
259
+ const currentHash = await computeTaskInputHash(cwd, rawInputPaths && rawInputPaths.length > 0 ? rawInputPaths : ['.']);
260
+ if (currentHash && task.lastInputHash && task.lastInputHash === currentHash) {
261
+ logger.info(`[dsh-cron] Task "${task.title}" (${taskId}) skipped: inputs unchanged (${currentHash})`);
262
+ if (scheduler.scopeLocks) scheduler.scopeLocks.release(task, taskId);
263
+ scheduler.running.delete(taskId);
264
+ scheduler.recordSkipped(taskId, `Skipped: inputs unchanged (${currentHash})`);
265
+ if (typeof scheduler.drainQueue === 'function') scheduler.drainQueue();
266
+ return {
267
+ ok: true,
268
+ status: 'skipped',
269
+ skippedReason: 'inputs unchanged',
270
+ inputHash: currentHash,
271
+ };
272
+ }
273
+ options.currentInputHash = currentHash;
274
+ }
275
+
228
276
  const preflightStart = Date.now();
229
277
  const preflight = await executePreflight(task);
230
278
  const preflightDurationMs = Date.now() - preflightStart;
231
279
  if (!preflight.ok) {
232
280
  logger.info(`[dsh-cron] task "${task.title}" (${taskId}) skipped: ${preflight.reason}`);
281
+ if (scheduler.scopeLocks) scheduler.scopeLocks.release(task, taskId);
233
282
  scheduler.running.delete(taskId);
234
283
  scheduler.recordSkipped(taskId, `Preflight check skipped: ${preflight.reason}`);
284
+ if (typeof scheduler.drainQueue === 'function') scheduler.drainQueue();
235
285
  return null;
236
286
  }
237
287
 
@@ -3,6 +3,8 @@ import { bestEffort } from '../best-effort.js';
3
3
  import { Cron } from 'croner';
4
4
  import { FileSystemWatcherManager } from '../watcher.js';
5
5
  import { parseNaturalSchedule } from '../nl-schedule.js';
6
+ import { ScopeLockManager } from '../scope-locks.js';
7
+ import { WakeTriggerManager } from '../wake-triggers.js';
6
8
 
7
9
  const MAX_TIMEOUT_MS = 2147483647; // 2^31 - 1 ms (~24.85 days)
8
10
  import {
@@ -337,6 +339,8 @@ export class TaskScheduler {
337
339
  this.groupLimits = opts.groupLimits instanceof Map ? opts.groupLimits : new Map(Object.entries(opts.groupLimits || {}));
338
340
  this.heartbeatTimer = null;
339
341
  this.watcherManager = new FileSystemWatcherManager(this);
342
+ this.scopeLocks = new ScopeLockManager();
343
+ this.wakeTriggerManager = new WakeTriggerManager(this);
340
344
  this.logger = opts.logger || null;
341
345
  this.isStopped = false;
342
346
  this.generation = 0;
@@ -373,6 +377,9 @@ export class TaskScheduler {
373
377
 
374
378
  armAdaptiveTimer(taskId, delayMs) {
375
379
  this.clearAdaptiveTimer(taskId);
380
+ if (this.wakeTriggerManager) {
381
+ this.wakeTriggerManager.unregisterTask(taskId);
382
+ }
376
383
  if (this.jobs.has(taskId)) {
377
384
  this.jobs.get(taskId).stop();
378
385
  this.jobs.delete(taskId);
@@ -467,6 +474,9 @@ export class TaskScheduler {
467
474
  if (this.watcherManager) {
468
475
  this.watcherManager.syncAll(tasks);
469
476
  }
477
+ if (this.wakeTriggerManager) {
478
+ this.wakeTriggerManager.syncTasks(tasks);
479
+ }
470
480
  }
471
481
 
472
482
  stopAll() {
@@ -476,6 +486,9 @@ export class TaskScheduler {
476
486
  if (this.watcherManager) {
477
487
  this.watcherManager.stopAll();
478
488
  }
489
+ if (this.wakeTriggerManager) {
490
+ this.wakeTriggerManager.stopAll();
491
+ }
479
492
 
480
493
  // Clear concurrency queue (#217)
481
494
  this.queue = [];
@@ -512,6 +525,9 @@ export class TaskScheduler {
512
525
 
513
526
  clearScheduled(taskId) {
514
527
  this.clearAdaptiveTimer(taskId);
528
+ if (this.wakeTriggerManager) {
529
+ this.wakeTriggerManager.unregisterTask(taskId);
530
+ }
515
531
  if (this.watcherManager) {
516
532
  this.watcherManager.unwatchTask(taskId);
517
533
  }
@@ -582,6 +598,9 @@ export class TaskScheduler {
582
598
  if (this.watcherManager) {
583
599
  this.watcherManager.watchTask(task);
584
600
  }
601
+ if (this.wakeTriggerManager) {
602
+ this.wakeTriggerManager.registerTask(task);
603
+ }
585
604
 
586
605
  try {
587
606
  const parsed = parseScheduleExpression(task.schedule);
@@ -669,6 +688,50 @@ export class TaskScheduler {
669
688
  return shouldUseFallback(task, outcome);
670
689
  }
671
690
 
691
+ drainQueue() {
692
+ if (this.isStopped || this.queue.length === 0) return;
693
+ if (this.maxConcurrent > 0 && this.running.size >= this.maxConcurrent) return;
694
+
695
+ let admittedIndex = -1;
696
+ for (let i = 0; i < this.queue.length; i++) {
697
+ const candidate = this.queue[i];
698
+ const queuedTask = this.store.get(candidate.taskId);
699
+ if (!queuedTask || queuedTask.status !== 'active') {
700
+ this.queue.splice(i, 1);
701
+ i--;
702
+ continue;
703
+ }
704
+ const qGroup = queuedTask.concurrencyGroup && queuedTask.concurrencyGroup !== 'default'
705
+ ? String(queuedTask.concurrencyGroup).trim()
706
+ : null;
707
+ const qLimit = this.getGroupLimit ? this.getGroupLimit(qGroup) : (qGroup ? 1 : 0);
708
+ if (qGroup && qLimit > 0) {
709
+ const inGroup = this.getRunningGroupCount ? this.getRunningGroupCount(qGroup) : 0;
710
+ if (inGroup >= qLimit) {
711
+ continue;
712
+ }
713
+ }
714
+
715
+ if (this.scopeLocks && !this.scopeLocks.canAcquire(queuedTask, candidate.taskId).ok) {
716
+ continue;
717
+ }
718
+
719
+ admittedIndex = i;
720
+ break;
721
+ }
722
+
723
+ if (admittedIndex !== -1) {
724
+ const nextItem = this.queue.splice(admittedIndex, 1)[0];
725
+ setImmediate(() => {
726
+ if (!this.isStopped) {
727
+ this.runTask(nextItem.taskId, nextItem.options || {}).catch((_runErr) => {
728
+ bestEffort('drain-queued-task', () => {}, this.logger);
729
+ });
730
+ }
731
+ });
732
+ }
733
+ }
734
+
672
735
  async runTask(taskId, options = {}) {
673
736
  if (this.isStopped) return null;
674
737
  return executeTask(this, taskId, options);
@@ -0,0 +1,189 @@
1
+ // @ts-check
2
+ import path from 'node:path';
3
+
4
+ /**
5
+ * Normalize an array or string of relative scopes.
6
+ * Leading slashes or './' are stripped, backslashes replaced with '/',
7
+ * trailing slashes removed (except root), empty strings filtered.
8
+ *
9
+ * @param {string[]|string|null|undefined} scopes
10
+ * @returns {string[]}
11
+ */
12
+ export function normalizeScopes(scopes) {
13
+ if (!scopes) return [];
14
+ const list = Array.isArray(scopes)
15
+ ? scopes
16
+ : String(scopes).split(/[\n,]+/).map((s) => s.trim());
17
+
18
+ const result = new Set();
19
+ for (let s of list) {
20
+ if (!s || typeof s !== 'string') continue;
21
+ let norm = s.trim().replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+/, '');
22
+ norm = norm.replace(/\/+$/, '');
23
+ if (norm.length > 0) {
24
+ result.add(norm);
25
+ }
26
+ }
27
+ return Array.from(result);
28
+ }
29
+
30
+ /**
31
+ * Check if two path scopes overlap.
32
+ * Overlap means:
33
+ * - A is equal to B ('src' === 'src')
34
+ * - A is parent of B ('src' is parent of 'src/components')
35
+ * - B is parent of A ('src/components' has parent 'src')
36
+ * - Either is root '.' or '*'
37
+ *
38
+ * @param {string} scopeA
39
+ * @param {string} scopeB
40
+ * @returns {boolean}
41
+ */
42
+ export function scopesOverlap(scopeA, scopeB) {
43
+ if (!scopeA || !scopeB) return false;
44
+ const a = scopeA.replace(/\/+$/, '');
45
+ const b = scopeB.replace(/\/+$/, '');
46
+ if (a === '.' || a === '*' || b === '.' || b === '*') return true;
47
+ if (a === b) return true;
48
+ if (b.startsWith(a + '/')) return true;
49
+ if (a.startsWith(b + '/')) return true;
50
+ return false;
51
+ }
52
+
53
+ /**
54
+ * Check if any scope in scopes1 overlaps with any scope in scopes2.
55
+ *
56
+ * @param {string[]|string} scopes1
57
+ * @param {string[]|string} scopes2
58
+ * @returns {{ conflict: true, scopeA: string, scopeB: string } | null}
59
+ */
60
+ export function hasScopeConflict(scopes1, scopes2) {
61
+ const norm1 = normalizeScopes(scopes1);
62
+ const norm2 = normalizeScopes(scopes2);
63
+ if (norm1.length === 0 || norm2.length === 0) return null;
64
+ for (const s1 of norm1) {
65
+ for (const s2 of norm2) {
66
+ if (scopesOverlap(s1, s2)) {
67
+ return { conflict: true, scopeA: s1, scopeB: s2 };
68
+ }
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+
74
+ /**
75
+ * ScopeLockManager
76
+ * Tracks active write scopes per workspace to prevent concurrent conflicts.
77
+ */
78
+ export class ScopeLockManager {
79
+ constructor() {
80
+ /** @type {Map<string, Map<string, Set<string>>>} */
81
+ this.locks = new Map();
82
+ }
83
+
84
+ /**
85
+ * Determine key for scoping (workspaceId or cwd).
86
+ *
87
+ * @param {any} task
88
+ * @returns {string}
89
+ */
90
+ getWorkspaceKey(task) {
91
+ if (task?.workspaceId && String(task.workspaceId).trim()) {
92
+ return 'ws:' + String(task.workspaceId).trim();
93
+ }
94
+ if (task?.cwd && String(task.cwd).trim()) {
95
+ return 'cwd:' + path.normalize(String(task.cwd).trim());
96
+ }
97
+ return 'default';
98
+ }
99
+
100
+ /**
101
+ * Check if task writeScopes can be acquired without conflict.
102
+ *
103
+ * @param {any} task
104
+ * @param {string} taskId
105
+ * @returns {{ ok: true } | { ok: false, conflictTaskId: string, conflictingScope: string, heldScope: string, workspaceKey: string }}
106
+ */
107
+ canAcquire(task, taskId) {
108
+ const scopes = normalizeScopes(task?.writeScopes);
109
+ if (scopes.length === 0) return { ok: true };
110
+
111
+ // Isolated worktrees don't conflict with main workspace files
112
+ if (task?.worktree) return { ok: true };
113
+
114
+ const wsKey = this.getWorkspaceKey(task);
115
+ const activeTasks = this.locks.get(wsKey);
116
+ if (!activeTasks || activeTasks.size === 0) return { ok: true };
117
+
118
+ for (const [activeTaskId, activeScopes] of activeTasks.entries()) {
119
+ if (activeTaskId === taskId) continue;
120
+ const conflict = hasScopeConflict(scopes, Array.from(activeScopes));
121
+ if (conflict) {
122
+ return {
123
+ ok: false,
124
+ conflictTaskId: activeTaskId,
125
+ conflictingScope: conflict.scopeA,
126
+ heldScope: conflict.scopeB,
127
+ workspaceKey: wsKey,
128
+ };
129
+ }
130
+ }
131
+ return { ok: true };
132
+ }
133
+
134
+ /**
135
+ * Register active write scopes for a running task.
136
+ *
137
+ * @param {any} task
138
+ * @param {string} taskId
139
+ * @returns {boolean}
140
+ */
141
+ acquire(task, taskId) {
142
+ const scopes = normalizeScopes(task?.writeScopes);
143
+ if (scopes.length === 0 || task?.worktree) return true;
144
+
145
+ const wsKey = this.getWorkspaceKey(task);
146
+ if (!this.locks.has(wsKey)) {
147
+ this.locks.set(wsKey, new Map());
148
+ }
149
+ this.locks.get(wsKey).set(taskId, new Set(scopes));
150
+ return true;
151
+ }
152
+
153
+ /**
154
+ * Release active write scopes when a task finishes.
155
+ *
156
+ * @param {any} task
157
+ * @param {string} taskId
158
+ */
159
+ release(task, taskId) {
160
+ const wsKey = this.getWorkspaceKey(task);
161
+ const activeTasks = this.locks.get(wsKey);
162
+ if (activeTasks) {
163
+ activeTasks.delete(taskId);
164
+ if (activeTasks.size === 0) {
165
+ this.locks.delete(wsKey);
166
+ }
167
+ }
168
+ }
169
+
170
+ /**
171
+ * Get active locks for inspection.
172
+ *
173
+ * @param {string} workspaceKey
174
+ * @returns {Array<{ taskId: string, scopes: string[] }>}
175
+ */
176
+ getActiveScopes(workspaceKey) {
177
+ const activeTasks = this.locks.get(workspaceKey);
178
+ if (!activeTasks) return [];
179
+ const all = [];
180
+ for (const [taskId, scopes] of activeTasks.entries()) {
181
+ all.push({ taskId, scopes: Array.from(scopes) });
182
+ }
183
+ return all;
184
+ }
185
+
186
+ clear() {
187
+ this.locks.clear();
188
+ }
189
+ }
@@ -95,6 +95,11 @@ export const TaskSchema = z.object({
95
95
  previousScript: z.string(),
96
96
  swarm: z.any(),
97
97
  gitDiff: z.any(),
98
+ writeScopes: z.any(),
99
+ inputHashPaths: z.any(),
100
+ skipIfUnchanged: z.boolean().default(false),
101
+ lastInputHash: z.string().default(''),
102
+ wakeTrigger: z.any(),
98
103
  maxMemoryMb: z.number().min(0).default(0),
99
104
  executionTimeoutMs: z.number().min(0).default(900000),
100
105
  maxLogBytesPerRun: z.number().min(0).default(5 * 1024 * 1024),
@@ -104,6 +104,11 @@ export const PATCHABLE_TASK_FIELDS = [
104
104
  'cpus',
105
105
  'maxArchiveMonths',
106
106
  'gitDiff',
107
+ 'writeScopes',
108
+ 'inputHashPaths',
109
+ 'skipIfUnchanged',
110
+ 'lastInputHash',
111
+ 'wakeTrigger',
107
112
  ];
108
113
 
109
114
  /** Fields a duplicate inherits; anything else is runtime state, not config. */
@@ -9,6 +9,9 @@ import { validateTaskType } from './task-transfer.js';
9
9
  import { parseScheduleExpression } from './scheduler.js';
10
10
  import { CHANNEL_IDS } from './channels.js';
11
11
  import { redactTaskSecrets } from './http-utils.js';
12
+ import { normalizeScopes } from './scope-locks.js';
13
+ import { normalizeWakeTrigger } from './wake-triggers.js';
14
+ import { normalizeInputHashPaths } from './input-hash.js';
12
15
  import { sanitizeDependsOn, sanitizeJoinPolicy, validateDAG } from './dag.js';
13
16
 
14
17
  export function sanitizeFileWatch(fw) {
@@ -62,6 +65,11 @@ export function executeCreateTask(store, scheduler, args) {
62
65
  swarm: args.swarm !== undefined ? sanitizeSwarmConfig(args.swarm) : undefined,
63
66
  elseTask: args.elseTask ? String(args.elseTask).trim() : undefined,
64
67
  autoHeal: args.autoHeal !== undefined ? Boolean(args.autoHeal) : undefined,
68
+ wakeTrigger: args.wakeTrigger !== undefined ? normalizeWakeTrigger(args.wakeTrigger) : undefined,
69
+ writeScopes: args.writeScopes !== undefined ? normalizeScopes(args.writeScopes) : undefined,
70
+ inputHashPaths: args.inputHashPaths !== undefined ? normalizeInputHashPaths(args.inputHashPaths) : undefined,
71
+ skipIfUnchanged: args.skipIfUnchanged !== undefined ? Boolean(args.skipIfUnchanged) : undefined,
72
+ lastInputHash: args.lastInputHash ? String(args.lastInputHash).trim() : undefined,
65
73
  selfHealing: args.selfHealing && typeof args.selfHealing === 'object' ? {
66
74
  autoApply: Boolean(args.selfHealing.autoApply),
67
75
  lastPatchedAt: Number(args.selfHealing.lastPatchedAt) || 0,
package/lib/task-patch.js CHANGED
@@ -20,6 +20,9 @@ import { normalizeTaskType, CODE_EXECUTING_TYPES, EXTERNAL_RUNTIMES } from './ru
20
20
  import { PATCHABLE_TASK_FIELDS, validateTaskType } from './task-transfer.js';
21
21
  import { pickPatchableFields, restoreTaskSecrets } from './http-utils.js';
22
22
  import { unknownChannelIds } from './channels.js';
23
+ import { normalizeScopes } from './scope-locks.js';
24
+ import { normalizeWakeTrigger } from './wake-triggers.js';
25
+ import { normalizeInputHashPaths } from './input-hash.js';
23
26
  import { isConfigOwned, configOwnedMessage } from './config-jobs.js';
24
27
 
25
28
  /** True when a patch changes a task into a type that executes code. */
@@ -132,6 +135,21 @@ export function buildTaskPatch(current, body) {
132
135
  if (patch.autoHeal !== undefined) {
133
136
  patch.autoHeal = Boolean(patch.autoHeal);
134
137
  }
138
+ if (patch.wakeTrigger !== undefined) {
139
+ patch.wakeTrigger = normalizeWakeTrigger(patch.wakeTrigger);
140
+ }
141
+ if (patch.writeScopes !== undefined) {
142
+ patch.writeScopes = normalizeScopes(patch.writeScopes);
143
+ }
144
+ if (patch.inputHashPaths !== undefined) {
145
+ patch.inputHashPaths = normalizeInputHashPaths(patch.inputHashPaths);
146
+ }
147
+ if (patch.skipIfUnchanged !== undefined) {
148
+ patch.skipIfUnchanged = Boolean(patch.skipIfUnchanged);
149
+ }
150
+ if (patch.lastInputHash !== undefined) {
151
+ patch.lastInputHash = String(patch.lastInputHash || '').trim();
152
+ }
135
153
  if (patch.selfHealing !== undefined && patch.selfHealing && typeof patch.selfHealing === 'object') {
136
154
  patch.selfHealing = {
137
155
  autoApply: Boolean(patch.selfHealing.autoApply),