donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
33 lines • 985 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowRuntime = void 0;
/**
* Tracks active Donobu flows and their associated metadata.
*
* This class is intentionally tiny: it is the single source of truth for
* in-memory flow state so consumers don't need to juggle multiple maps or
* embed lifecycle bookkeeping in higher-level managers.
*/
class FlowRuntime {
constructor() {
this.activeFlows = new Map();
}
register(flowHandle) {
this.activeFlows.set(flowHandle.donobuFlow.metadata.id, flowHandle);
}
get(flowId) {
return this.activeFlows.get(flowId);
}
remove(flowId) {
this.activeFlows.delete(flowId);
}
metadataFor(flowId) {
const handle = this.activeFlows.get(flowId);
return handle?.donobuFlow.metadata;
}
handles() {
return this.activeFlows.values();
}
}
exports.FlowRuntime = FlowRuntime;
//# sourceMappingURL=FlowRuntime.js.map