Let a nested behavior without a start node run from On start (#230)
A behavior built as a plain behavior, with On start and no Behavior start, did nothing when another behavior called it through Run behavior. The node only showed a warning. Such a behavior should run as a call too, without the author having to rebuild its entry. - New callEntries() in nested.ts returns the Behavior start node or, when there is none, every On start node. callProblem uses it too. - GraphInterpreter.call() follows all entries one after the other, in graph order, in the same frame and with the same variables. - Behavior end still returns what reaches it. A call through On start has no inputs, because only the start node declares them. - It is a fallback only. With a Behavior start present, On start nodes stay out of the call. - The node warning now reads "No start or On start node - does nothing" and only shows when neither exists. - Keep and local state machines behave as before. Tests: - ./check.sh: 163 files, 2396 tests, CHECK EXIT 0 (before 2392). - 4 new unit tests in tests/core/nested-behavior.test.ts: the flow after On start runs, the return value arrives, several On start nodes run in graph order, a start node keeps On start out. - e2e 19: ALL PASSED, 35 checks. Only the expected warning text changed, the check sum stays at 1385. - Counter-checks: without the fallback 3 tests fail. With only the first On start exactly the order test fails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
454d202109
commit
21d7149756
5 files changed
+117
-33
No files matched your search
@@ -4,16 +4,17 @@ import { BEHAVIOR_END, BEHAVIOR_PARAM, BEHAVIOR_START, declaredPorts, RUN_BEHAVI
|
||||
import { exec } from '../shared';
|
||||
|
||||
/**
|
||||
* Runs another behavior's graph in place, from its start node to its end node. Its ports are those
|
||||
* the named behavior declares; the interpreter does the call, because only it can hold a second
|
||||
* graph's pulse.
|
||||
* Runs another behavior's graph in place, from its start node (or its `On start` nodes, #230) to
|
||||
* its end node. Its ports are those the named behavior declares; the interpreter does the call,
|
||||
* because only it can hold a second graph's pulse.
|
||||
*/
|
||||
export const RunBehavior: NodeDef = {
|
||||
type: RUN_BEHAVIOR,
|
||||
label: 'Run behavior',
|
||||
category: 'flow',
|
||||
description:
|
||||
'Runs another behavior as a step of this one, passing values in and taking results out. A ' +
|
||||
'Runs another behavior as a step of this one, passing values in and taking results out. It ' +
|
||||
'begins at the Behavior start node, or at On start if that behavior has none. A ' +
|
||||
'variable marked Keep in that behavior carries on from the last call of this node on this ' +
|
||||
'object; the others start at their defaults every time.',
|
||||
inputs: [exec()],
|
||||
|
||||
Reference in new issue
Block a user