syndicate-js/packages/core/src/runtime/task.ts

23 lines
648 B
TypeScript
Raw Normal View History

2023-05-28 09:18:29 +00:00
/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2023 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
2023-05-28 10:03:45 +00:00
import type { Facet } from './actor.js';
2023-05-28 09:18:29 +00:00
2023-05-28 10:03:45 +00:00
import * as q from '../gen/queuedTasks.js';
2023-05-28 09:18:29 +00:00
export type Task = StructuredTask<TaskDescription>;
export interface StructuredTask<T> {
perform(): void;
describe(): T;
}
export type TaskDescription =
2023-05-28 10:03:45 +00:00
| { type: 'bootActor', detail: q.OptionalAny }
2023-05-28 09:18:29 +00:00
| { type: 'turn', tasks: TaskAction[] }
| { type: 'externalTurn' }
2023-05-28 09:18:29 +00:00
;
export type TaskAction = { targetFacet: Facet, action: ActionDescription };
2023-05-28 10:03:45 +00:00
export type ActionDescription = q.ActionDescription;