P6: convert reactor to platform infrastructure
Refactor of reactor to use BaseNodeAdapter + commandRegistry + statusBadge. reactor follows the platform refactor plan in .claude/refactor/MODULE_SPLIT.md. Tests stay green; CONTRACT.md generated; legacy aliases preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
src/commands/handlers.js
Normal file
25
src/commands/handlers.js
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
// Reactor input handlers. Each receives (source, msg, ctx) where source is
|
||||
// the Reactor domain and ctx is { node, RED, send, logger }. The handlers
|
||||
// either forward to engine setters or drive a synchronous state update.
|
||||
|
||||
exports.dataClock = (source, msg) => {
|
||||
source.updateState(msg.timestamp ?? Date.now());
|
||||
};
|
||||
|
||||
exports.dataFluent = (source, msg) => { source.setInfluent = msg; };
|
||||
exports.dataOTR = (source, msg) => { source.setOTR = msg; };
|
||||
exports.dataTemperature = (source, msg) => { source.setTemperature = msg; };
|
||||
exports.dataDispersion = (source, msg) => { source.setDispersion = msg; };
|
||||
|
||||
exports.childRegister = (source, msg, ctx) => {
|
||||
const childId = msg.payload;
|
||||
const RED = ctx?.RED;
|
||||
const childObj = RED?.nodes?.getNode?.(childId);
|
||||
if (!childObj || !childObj.source) {
|
||||
source?.logger?.warn?.(`registerChild skipped: missing child/source for id=${childId}`);
|
||||
return;
|
||||
}
|
||||
source.childRegistrationUtils.registerChild(childObj.source, msg.positionVsParent);
|
||||
};
|
||||
Reference in New Issue
Block a user