fix: correct event types, properties, and Task annotation

- Use 'task_start'/'task_complete' (underscores) instead of colons
- Use event.task/event.agent instead of non-existent taskTitle/agentName
- Remove Task import; runTasks() accepts a lighter inline type
This commit is contained in:
Matt Van Horn 2026-04-07 16:46:50 -07:00
parent 0fd18d8a19
commit 40f13a09a6
1 changed files with 7 additions and 6 deletions

View File

@ -18,7 +18,7 @@
*/
import { OpenMultiAgent } from '../src/index.js'
import type { AgentConfig, OrchestratorEvent, Task } from '../src/types.js'
import type { AgentConfig, OrchestratorEvent } from '../src/types.js'
// ---------------------------------------------------------------------------
// API spec to implement
@ -97,11 +97,12 @@ Deduplicate overlapping feedback. Keep the report to 200-300 words.`,
// ---------------------------------------------------------------------------
function handleProgress(event: OrchestratorEvent): void {
if (event.type === 'task:start') {
console.log(` [START] ${event.taskTitle}${event.agentName}`)
if (event.type === 'task_start') {
console.log(` [START] ${event.task ?? '?'}${event.agent ?? '?'}`)
}
if (event.type === 'task:complete') {
console.log(` [DONE] ${event.taskTitle} (${event.success ? 'OK' : 'FAIL'})`)
if (event.type === 'task_complete') {
const success = (event.data as { success?: boolean })?.success ?? true
console.log(` [DONE] ${event.task ?? '?'} (${success ? 'OK' : 'FAIL'})`)
}
}
@ -120,7 +121,7 @@ const team = orchestrator.createTeam('code-review-team', {
// Tasks
// ---------------------------------------------------------------------------
const tasks: Task[] = [
const tasks = [
{
title: 'Generate code',
description: `Write a Node.js Express route handler for this API spec:\n\n${API_SPEC}\n\nStore the complete code in shared memory as "generated_code".`,