diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:50:37 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 10:50:37 +0200 |
| commit | 6fb1cc4e2840a359f628245d7fb81d4666246780 (patch) | |
| tree | ac6ec1c5c9ff873d31e0fabe12400a3ccdf69c31 /lua/clever_f/motion_executor.lua | |
| parent | 3b0769600b73db271c8cb694d1c8cf7a00493e1b (diff) | |
Commit command success
Diffstat (limited to 'lua/clever_f/motion_executor.lua')
| -rw-r--r-- | lua/clever_f/motion_executor.lua | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lua/clever_f/motion_executor.lua b/lua/clever_f/motion_executor.lua index cc3cc56..72a66bd 100644 --- a/lua/clever_f/motion_executor.lua +++ b/lua/clever_f/motion_executor.lua @@ -1,6 +1,7 @@ local destination_engine = require("clever_f.destination_engine") local domain = require("clever_f.domain") local sequence_state = require("clever_f.sequence_state") +local state_transitions = require("clever_f.state_transitions") local text_topology = require("clever_f.text_topology") local M = {} @@ -105,6 +106,16 @@ local function require_state(state) return state end +local function require_transitions(transitions, state) + transitions = transitions or state_transitions.new(state) + if type(transitions) ~= "table" + or type(transitions.CommitCommandSuccess) ~= "function" + then + fail("MotionExecutor transitions must commit command success", 3) + end + return transitions +end + local executor_metatable = { __index = MotionExecutor, __newindex = function() @@ -123,6 +134,7 @@ function MotionExecutor.new(options, dependencies) end local executor = setmetatable({}, executor_metatable) + local state = require_state(options.state) executor_records[executor] = { host = require_host(options.host), destination_engine = require_destination_engine( @@ -131,7 +143,11 @@ function MotionExecutor.new(options, dependencies) feedback_service = require_feedback_service( options.feedback_service or options.feedback ), - state = require_state(options.state), + state = state, + transitions = require_transitions( + options.transitions or options.state_transitions, + state + ), } return executor end @@ -208,6 +224,11 @@ function MotionExecutor:_execute_command(request) outcome.endpoint ) migrate_command_feedback(self, request, origin, outcome) + executor_records[self].transitions:CommitCommandSuccess( + request.context, + outcome.endpoint, + request.moved_forward + ) return domain.ActionOutcome.from_search(outcome, request.plan.descriptor) end |
