Skip to content

Commit

Permalink
Use parallel plan representation when debugging
Browse files Browse the repository at this point in the history
This makes logs clearer about the sequence of operations

Change-type: patch
  • Loading branch information
pipex committed Apr 30, 2024
1 parent 6f04dcf commit 59d9fa9
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/agent/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,6 @@ export class Runtime<TState> {

const { logger } = this.opts;

const flatten = <T>(node: PlanNode<T> | null) => {
return DAG.reduce(
node,
(acc: string[], a: PlanAction<T>) => acc.concat([a.action.description]),
[],
);
};

this.promise = (async () => {
this.running = true;

Expand All @@ -272,7 +264,9 @@ export class Runtime<TState> {
}

logger.debug('plan found, will execute the following actions:');
flatten(start).map((action) => logger.debug('-', action));
DAG.toString(start, (a: PlanAction<TState>) => a.action.description)
.split('\n')
.map((action) => logger.debug(action));

// Execute the plan
await this.runPlan(start);
Expand Down

0 comments on commit 59d9fa9

Please sign in to comment.