@goodandready/dsh-cron 0.3.12 → 0.3.14
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/README.md +24 -0
- package/README.ru.md +24 -0
- package/README.zh.md +24 -0
- package/lib/api.js +180 -5
- package/lib/branching.js +341 -0
- package/lib/client.js +949 -758
- package/lib/dag.js +88 -18
- package/lib/doctor.js +431 -0
- package/lib/git-diff.js +226 -0
- package/lib/scheduler-execution.js +98 -6
- package/lib/store.js +4 -0
- package/lib/swarm.js +303 -0
- package/lib/task-create.js +11 -0
- package/lib/task-patch.js +19 -1
- package/lib/task-transfer.js +9 -0
- package/package.json +1 -1
package/lib/task-create.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { sanitizeSwarmConfig } from './swarm.js';
|
|
2
|
+
import { sanitizeBranchRules } from './branching.js';
|
|
1
3
|
import { sanitizePromptHistory } from './prompt-evolver.js';
|
|
2
4
|
import { sanitizeAdaptiveConfig } from './adaptive.js';
|
|
3
5
|
import { sanitizeValidators } from './validators.js';
|
|
@@ -55,6 +57,15 @@ export function executeCreateTask(store, scheduler, args) {
|
|
|
55
57
|
webhookDebounceMs: args.webhookDebounceMs !== undefined ? Number(args.webhookDebounceMs) : (args.webhookTrigger?.debounceMs !== undefined ? Number(args.webhookTrigger.debounceMs) : undefined),
|
|
56
58
|
onSuccess: args.onSuccess ? String(args.onSuccess).trim() : '',
|
|
57
59
|
onFailure: args.onFailure ? String(args.onFailure).trim() : '',
|
|
60
|
+
branchRules: args.branchRules !== undefined ? sanitizeBranchRules(args.branchRules) : undefined,
|
|
61
|
+
swarm: args.swarm !== undefined ? sanitizeSwarmConfig(args.swarm) : undefined,
|
|
62
|
+
elseTask: args.elseTask ? String(args.elseTask).trim() : undefined,
|
|
63
|
+
autoHeal: args.autoHeal !== undefined ? Boolean(args.autoHeal) : undefined,
|
|
64
|
+
selfHealing: args.selfHealing && typeof args.selfHealing === 'object' ? {
|
|
65
|
+
autoApply: Boolean(args.selfHealing.autoApply),
|
|
66
|
+
lastPatchedAt: Number(args.selfHealing.lastPatchedAt) || 0,
|
|
67
|
+
autoPatchesCount: Number(args.selfHealing.autoPatchesCount) || 0,
|
|
68
|
+
} : undefined,
|
|
58
69
|
dependsOn: args.dependsOn !== undefined ? sanitizeDependsOn(args.dependsOn) : undefined,
|
|
59
70
|
joinPolicy: args.joinPolicy !== undefined ? sanitizeJoinPolicy(args.joinPolicy) : undefined,
|
|
60
71
|
adaptive: args.adaptive !== undefined ? sanitizeAdaptiveConfig(args.adaptive) : undefined,
|
package/lib/task-patch.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { sanitizeSwarmConfig } from './swarm.js';
|
|
2
|
+
import { sanitizeBranchRules } from './branching.js';
|
|
1
3
|
import { trackPromptEdit, sanitizePromptHistory } from './prompt-evolver.js';
|
|
2
4
|
import { sanitizeAdaptiveConfig } from './adaptive.js';
|
|
3
5
|
import { sanitizeValidators } from './validators.js';
|
|
@@ -121,6 +123,22 @@ export function buildTaskPatch(current, body) {
|
|
|
121
123
|
if (patch.validators !== undefined) {
|
|
122
124
|
patch.validators = Array.isArray(patch.validators) ? sanitizeValidators(patch.validators) : [];
|
|
123
125
|
}
|
|
126
|
+
if (patch.branchRules !== undefined) {
|
|
127
|
+
patch.branchRules = sanitizeBranchRules(patch.branchRules);
|
|
128
|
+
}
|
|
129
|
+
if (patch.elseTask !== undefined) {
|
|
130
|
+
patch.elseTask = patch.elseTask ? String(patch.elseTask).trim() : null;
|
|
131
|
+
}
|
|
132
|
+
if (patch.autoHeal !== undefined) {
|
|
133
|
+
patch.autoHeal = Boolean(patch.autoHeal);
|
|
134
|
+
}
|
|
135
|
+
if (patch.selfHealing !== undefined && patch.selfHealing && typeof patch.selfHealing === 'object') {
|
|
136
|
+
patch.selfHealing = {
|
|
137
|
+
autoApply: Boolean(patch.selfHealing.autoApply),
|
|
138
|
+
lastPatchedAt: Number(patch.selfHealing.lastPatchedAt) || 0,
|
|
139
|
+
autoPatchesCount: Number(patch.selfHealing.autoPatchesCount) || 0,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
124
142
|
if (patch.prompt !== undefined && current && typeof current.prompt === 'string') {
|
|
125
143
|
const edit = trackPromptEdit(current, patch.prompt, body && body.promptNote ? body.promptNote : 'Manual edit');
|
|
126
144
|
patch.prompt = edit.prompt;
|
|
@@ -181,7 +199,7 @@ export function applyTaskPatch({ store, scheduler, id, body, allowCodeSwitch = f
|
|
|
181
199
|
}
|
|
182
200
|
const built = buildTaskPatch(current, body);
|
|
183
201
|
if (!built.ok) return built;
|
|
184
|
-
if (built.patch.dependsOn !== undefined || built.patch.onSuccess !== undefined) {
|
|
202
|
+
if (built.patch.dependsOn !== undefined || built.patch.onSuccess !== undefined || built.patch.branchRules !== undefined || built.patch.elseTask !== undefined) {
|
|
185
203
|
const dagCheck = validateDAG(store?.tasks || {}, { ...current, ...built.patch, id });
|
|
186
204
|
if (!dagCheck.ok) {
|
|
187
205
|
return { ok: false, error: dagCheck.error };
|
package/lib/task-transfer.js
CHANGED
|
@@ -89,6 +89,15 @@ export const PATCHABLE_TASK_FIELDS = [
|
|
|
89
89
|
'adaptiveState',
|
|
90
90
|
'promptVersion',
|
|
91
91
|
'promptHistory',
|
|
92
|
+
'branchRules',
|
|
93
|
+
'elseTask',
|
|
94
|
+
'autoHeal',
|
|
95
|
+
'selfHealing',
|
|
96
|
+
'revisions',
|
|
97
|
+
'previousPrompt',
|
|
98
|
+
'previousScript',
|
|
99
|
+
'swarm',
|
|
100
|
+
'gitDiff',
|
|
92
101
|
];
|
|
93
102
|
|
|
94
103
|
/** Fields a duplicate inherits; anything else is runtime state, not config. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-cron",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "Background automation runner for DSH: isolated agent runs, script/HTTP/SSH/Docker runtimes, cost guard, notifications, heartbeats.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|