feat: added reduce and connection logic

A rule still needs to be added to the inferred belief handles to prevent cyclical inferredBeliefs, but aside from that logic ifs finished.

ref: N25B-433
This commit is contained in:
JGerla
2026-01-12 16:44:25 +01:00
parent 0a4940bdd0
commit b869f7c071
5 changed files with 70 additions and 31 deletions

View File

@@ -11,8 +11,8 @@ import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleB
import {allowOnlyConnectionsFromHandle, allowOnlyConnectionsFromType} from "../HandleRules.ts";
import useFlowStore from '../VisProgStores';
import { PlanReduce, type Plan } from '../components/Plan';
import PlanEditorDialog from '../components/PlanEditor';
import { BasicBeliefReduce } from './BasicBeliefNode.tsx';
import PlanEditorDialog from '../components/PlanEditor';
import {BeliefReduce} from "./BeliefReduce.ts";
/**
* The default data structure for a Trigger node
@@ -92,7 +92,7 @@ export default function TriggerNode(props: NodeProps<TriggerNode>) {
export function TriggerReduce(node: Node, nodes: Node[]) {
const data = node.data as TriggerNodeData;
const conditionNode = data.condition ? nodes.find((n)=>n.id===data.condition) : undefined
const conditionData = conditionNode ? BasicBeliefReduce(conditionNode, nodes) : ""
const conditionData = conditionNode ? BeliefReduce(conditionNode, nodes) : ""
return {
id: node.id,
condition: conditionData, // Make sure we have a condition before reducing, or default to ""