feat(task): add task labels and push-based task events

This commit is contained in:
2026-01-26 00:39:30 +00:00
parent 9a3a3e3eab
commit 6030fb2805
9 changed files with 360 additions and 9 deletions

View File

@@ -20,6 +20,20 @@
- **BufferRunner**: When `catchErrors: false`, buffered task errors now reject the trigger promise (via `CycleCounter.informOfCycleError`) instead of silently resolving with `undefined`
- **TaskChain stubs completed**: `removeTask(task)` returns `boolean`, `shiftTask()` returns `Task | undefined`
## Task Labels (v4.1.0+)
- `Task` constructor accepts optional `labels?: Record<string, string>`
- Helper methods: `setLabel(key, value)`, `getLabel(key)`, `removeLabel(key)`, `hasLabel(key, value?)`
- `getMetadata()` includes `labels` (shallow copy)
- `TaskManager.getTasksByLabel(key, value)` returns matching `Task[]`
- `TaskManager.getTasksMetadataByLabel(key, value)` returns matching `ITaskMetadata[]`
## Push-Based Events (v4.1.0+)
- `Task.eventSubject`: rxjs `Subject<ITaskEvent>` emitting `'started'`, `'step'`, `'completed'`, `'failed'` events
- `TaskManager.taskSubject`: aggregated `Subject<ITaskEvent>` from all added tasks
- `TaskManager.removeTask(task)` unsubscribes and removes from map
- `TaskManager.stop()` cleans up all event subscriptions
- Exported types: `ITaskEvent`, `TTaskEventType`
## Project Structure
- Source in `ts/`, web components in `ts_web/`
- Tests in `test/` - naming: `*.node.ts`, `*.browser.ts`, `*.both.ts`