openclaw-scheduler 0.2.8 → 0.2.9
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/dispatch/paths.mjs +36 -0
- package/package.json +2 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync } from 'fs';
|
|
2
|
+
import { dirname, join, resolve as pathResolve } from 'path';
|
|
3
|
+
import { homedir } from 'os';
|
|
4
|
+
|
|
5
|
+
function schedulerHome() {
|
|
6
|
+
return process.env.OPENCLAW_SCHEDULER_HOME ||
|
|
7
|
+
join(process.env.HOME || homedir(), '.openclaw', 'scheduler');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function resolveDispatchStateDir() {
|
|
11
|
+
return process.env.DISPATCH_STATE_DIR ||
|
|
12
|
+
join(schedulerHome(), 'dispatch');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function resolveLabelsPath({ legacyCandidates = [] } = {}) {
|
|
16
|
+
if (process.env.DISPATCH_LABELS_PATH) {
|
|
17
|
+
mkdirSync(dirname(process.env.DISPATCH_LABELS_PATH), { recursive: true });
|
|
18
|
+
return process.env.DISPATCH_LABELS_PATH;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const labelsPath = join(resolveDispatchStateDir(), 'labels.json');
|
|
22
|
+
mkdirSync(dirname(labelsPath), { recursive: true });
|
|
23
|
+
|
|
24
|
+
if (!existsSync(labelsPath)) {
|
|
25
|
+
const normalizedTarget = pathResolve(labelsPath);
|
|
26
|
+
const legacyPath = legacyCandidates
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.map((candidate) => pathResolve(candidate))
|
|
29
|
+
.find((candidate) => candidate !== normalizedTarget && existsSync(candidate));
|
|
30
|
+
if (legacyPath) {
|
|
31
|
+
copyFileSync(legacyPath, labelsPath);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return labelsPath;
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-scheduler",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "SQLite-backed job scheduler and workflow engine for OpenClaw agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dispatch/index.mjs",
|
|
45
45
|
"dispatch/liveness.mjs",
|
|
46
46
|
"dispatch/message-input.mjs",
|
|
47
|
+
"dispatch/paths.mjs",
|
|
47
48
|
"dispatch/README.md",
|
|
48
49
|
"dispatch/watcher.mjs",
|
|
49
50
|
"scripts/dispatch-cli-utils.mjs",
|