feat(FN-1872): merge fusion/fn-1872
This commit is contained in:
@@ -286,6 +286,22 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!options!.routineStore) {
|
||||||
|
const rs = engine.getRoutineStore();
|
||||||
|
if (rs) options = { ...options, routineStore: rs };
|
||||||
|
}
|
||||||
|
if (!options!.routineRunner) {
|
||||||
|
const rr = engine.getRoutineRunner();
|
||||||
|
if (rr) {
|
||||||
|
options = {
|
||||||
|
...options,
|
||||||
|
routineRunner: {
|
||||||
|
triggerManual: rr.triggerManual.bind(rr),
|
||||||
|
triggerWebhook: rr.triggerWebhook.bind(rr),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register callback for lazy engine startup on secondary projects
|
// Register callback for lazy engine startup on secondary projects
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { PrMonitor } from "./pr-monitor.js";
|
|||||||
import { PrCommentHandler } from "./pr-comment-handler.js";
|
import { PrCommentHandler } from "./pr-comment-handler.js";
|
||||||
import { NtfyNotifier } from "./notifier.js";
|
import { NtfyNotifier } from "./notifier.js";
|
||||||
import { CronRunner, createAiPromptExecutor } from "./cron-runner.js";
|
import { CronRunner, createAiPromptExecutor } from "./cron-runner.js";
|
||||||
|
import type { RoutineRunner } from "./routine-runner.js";
|
||||||
import { aiMergeTask } from "./merger.js";
|
import { aiMergeTask } from "./merger.js";
|
||||||
import { PRIORITY_MERGE } from "./concurrency.js";
|
import { PRIORITY_MERGE } from "./concurrency.js";
|
||||||
import { runtimeLog } from "./logger.js";
|
import { runtimeLog } from "./logger.js";
|
||||||
@@ -286,6 +287,16 @@ export class ProjectEngine {
|
|||||||
return this.automationStore;
|
return this.automationStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Get the RoutineStore (if initialized). */
|
||||||
|
getRoutineStore(): import("@fusion/core").RoutineStore | undefined {
|
||||||
|
return this.runtime.getRoutineStore();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the RoutineRunner (if initialized). */
|
||||||
|
getRoutineRunner(): RoutineRunner | undefined {
|
||||||
|
return this.runtime.getRoutineRunner();
|
||||||
|
}
|
||||||
|
|
||||||
/** Get the HeartbeatTriggerScheduler from the underlying runtime, if initialized. */
|
/** Get the HeartbeatTriggerScheduler from the underlying runtime, if initialized. */
|
||||||
getHeartbeatTriggerScheduler(): HeartbeatTriggerScheduler | undefined {
|
getHeartbeatTriggerScheduler(): HeartbeatTriggerScheduler | undefined {
|
||||||
return this.runtime.getTriggerScheduler();
|
return this.runtime.getTriggerScheduler();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type {
|
|||||||
PluginStore,
|
PluginStore,
|
||||||
PluginLoader,
|
PluginLoader,
|
||||||
MessageStore,
|
MessageStore,
|
||||||
|
RoutineStore,
|
||||||
} from "@fusion/core";
|
} from "@fusion/core";
|
||||||
import { Scheduler } from "../scheduler.js";
|
import { Scheduler } from "../scheduler.js";
|
||||||
import { TaskExecutor, type TaskExecutorOptions } from "../executor.js";
|
import { TaskExecutor, type TaskExecutorOptions } from "../executor.js";
|
||||||
@@ -88,6 +89,7 @@ export class InProcessRuntime
|
|||||||
private pluginStore?: PluginStore;
|
private pluginStore?: PluginStore;
|
||||||
private pluginLoader?: PluginLoader;
|
private pluginLoader?: PluginLoader;
|
||||||
private routineRunner?: RoutineRunner;
|
private routineRunner?: RoutineRunner;
|
||||||
|
private routineStore?: RoutineStore;
|
||||||
private routineScheduler?: RoutineScheduler;
|
private routineScheduler?: RoutineScheduler;
|
||||||
private missionExecutionLoop?: MissionExecutionLoop;
|
private missionExecutionLoop?: MissionExecutionLoop;
|
||||||
private missionAutopilot?: MissionAutopilot;
|
private missionAutopilot?: MissionAutopilot;
|
||||||
@@ -446,6 +448,7 @@ export class InProcessRuntime
|
|||||||
if (typeof RoutineStoreClass.prototype.getDueRoutines === "function") {
|
if (typeof RoutineStoreClass.prototype.getDueRoutines === "function") {
|
||||||
const routineStore = new RoutineStoreClass(this.taskStore.getFusionDir());
|
const routineStore = new RoutineStoreClass(this.taskStore.getFusionDir());
|
||||||
await routineStore.init();
|
await routineStore.init();
|
||||||
|
this.routineStore = routineStore;
|
||||||
|
|
||||||
if (this.heartbeatMonitor) {
|
if (this.heartbeatMonitor) {
|
||||||
const routineRunnerOptions: RoutineRunnerOptions = {
|
const routineRunnerOptions: RoutineRunnerOptions = {
|
||||||
@@ -754,6 +757,14 @@ export class InProcessRuntime
|
|||||||
return this.routineRunner;
|
return this.routineRunner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the RoutineStore instance (if initialized).
|
||||||
|
* Returns undefined when RoutineStore is not available.
|
||||||
|
*/
|
||||||
|
getRoutineStore(): RoutineStore | undefined {
|
||||||
|
return this.routineStore;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the RoutineScheduler instance (if initialized).
|
* Get the RoutineScheduler instance (if initialized).
|
||||||
* Returns undefined when RoutineStore is not available.
|
* Returns undefined when RoutineStore is not available.
|
||||||
|
|||||||
Reference in New Issue
Block a user