@cfio/cohort-sync 0.4.4 → 0.4.6

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/dist/index.js CHANGED
@@ -11917,6 +11917,10 @@ function getChannelAgent(channelId) {
11917
11917
  }
11918
11918
 
11919
11919
  // src/sync.ts
11920
+ var cronStorePath = null;
11921
+ function setCronStorePath(p) {
11922
+ cronStorePath = p;
11923
+ }
11920
11924
  function extractJson(raw) {
11921
11925
  const jsonStart = raw.search(/[\[{]/);
11922
11926
  const jsonEndBracket = raw.lastIndexOf("]");
@@ -11950,7 +11954,11 @@ function fetchSkills(logger) {
11950
11954
  }
11951
11955
  function fetchCronJobs(logger) {
11952
11956
  try {
11953
- const storePath = path.join(os.homedir(), ".openclaw", "cron", "jobs.json");
11957
+ const storePath = cronStorePath ?? path.join(os.homedir(), ".openclaw", "cron", "jobs.json");
11958
+ if (!fs.existsSync(storePath)) {
11959
+ logger.warn(`cohort-sync: cron store not found at ${storePath}`);
11960
+ return null;
11961
+ }
11954
11962
  const raw = fs.readFileSync(storePath, "utf-8");
11955
11963
  const parsed = JSON.parse(raw);
11956
11964
  const jobs = Array.isArray(parsed?.jobs) ? parsed.jobs : [];
@@ -12845,6 +12853,18 @@ function registerHooks(api, cfg) {
12845
12853
  agentIds: (config?.agents?.list ?? []).map((a) => a.id),
12846
12854
  agentMessageProviders: (config?.agents?.list ?? []).map((a) => ({ id: a.id, mp: a.messageProvider }))
12847
12855
  });
12856
+ const resolvedCronPath = typeof api.resolvePath === "function" ? api.resolvePath("cron/jobs.json") : null;
12857
+ const runtimeKeys = api.runtime ? Object.keys(api.runtime) : [];
12858
+ const runtimeMethods = api.runtime ? Object.keys(api.runtime).filter((k) => typeof api.runtime[k] === "function") : [];
12859
+ diag("CONFIG_DUMP", {
12860
+ resolvedCronPath,
12861
+ cronPathExists: resolvedCronPath ? fs2.existsSync(resolvedCronPath) : false,
12862
+ runtimeKeys,
12863
+ runtimeMethods
12864
+ });
12865
+ if (resolvedCronPath && typeof resolvedCronPath === "string") {
12866
+ setCronStorePath(resolvedCronPath);
12867
+ }
12848
12868
  setConvexUrl(cfg);
12849
12869
  setLogger(logger);
12850
12870
  restoreFromHotReload(logger);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Syncs agent status and skills to Cohort dashboard",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfio/cohort-sync",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Syncs agent status and skills to Cohort dashboard",
5
5
  "license": "MIT",
6
6
  "homepage": "https://docs.cohort.bot/gateway",