balena-io-modules / mahler

A automated task composer and HTN based planner for building autonomous system agents.
Apache License 2.0
7 stars 1 forks source link

Mahler v4 release #70

Closed pipex closed 3 months ago

pipex commented 5 months ago

Closes: #68

Release Notes

Breaking changes

Simplified Sensor interface

The ouput of a Sensor is now a Subscribable instance that emits Operation values. The sensor no longer modifies the agent state but only returns changes that are applied by the Agent runtime.

This makes state management more robust as state is only modified by the agent runtime, preventing non-determinism on state reporting because of concurrency.

Removed logger option when constructing an Agent

The option has been replaced by a single trace option, which expects a void function that will be called for each agent runtime event. The function can be used to generate human readable logs or to log agent progress on disk. The agent runtime events relate to each other according to the following diagram. Agent runtime state machine

Note that this also means that the Agent runtime no longer produces human readable logs by default. In order to get a readable log a readableTrace function has now be added on mahler/utils. The function accepts a Logger instance.

import { readableTrace } from 'mahler/utils';

const agent = Agent.from({
    initial: 0,
    tasks: [/* task list */],
    // readableTrace requires a Logger instance
    opts: { trace: readableTrace(console) },
});

Minor improvements

Other improvements

Other changes include refactoring, better linting, improved types and some updated dev dependencies.

pipex commented 3 months ago

I self-certify!