macro-agent 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.macro-agent/teams/self-driving/prompts/grinder.md +27 -0
- package/.macro-agent/teams/self-driving/prompts/judge.md +27 -0
- package/.macro-agent/teams/self-driving/prompts/planner.md +33 -0
- package/.macro-agent/teams/self-driving/roles/grinder.yaml +17 -0
- package/.macro-agent/teams/self-driving/roles/judge.yaml +24 -0
- package/.macro-agent/teams/self-driving/roles/planner.yaml +18 -0
- package/.macro-agent/teams/self-driving/team.yaml +103 -0
- package/.macro-agent/teams/structured/prompts/developer.md +26 -0
- package/.macro-agent/teams/structured/prompts/lead.md +25 -0
- package/.macro-agent/teams/structured/prompts/reviewer.md +24 -0
- package/.macro-agent/teams/structured/roles/developer.yaml +12 -0
- package/.macro-agent/teams/structured/roles/lead.yaml +11 -0
- package/.macro-agent/teams/structured/roles/reviewer.yaml +19 -0
- package/.macro-agent/teams/structured/team.yaml +89 -0
- package/.sudocode/issues.jsonl +56 -51
- package/.sudocode/specs.jsonl +8 -1
- package/CLAUDE.md +121 -30
- package/README.md +60 -3
- package/dist/acp/macro-agent.d.ts +4 -0
- package/dist/acp/macro-agent.d.ts.map +1 -1
- package/dist/acp/macro-agent.js +50 -4
- package/dist/acp/macro-agent.js.map +1 -1
- package/dist/acp/session-mapper.d.ts +20 -1
- package/dist/acp/session-mapper.d.ts.map +1 -1
- package/dist/acp/session-mapper.js +90 -1
- package/dist/acp/session-mapper.js.map +1 -1
- package/dist/acp/types.d.ts +24 -1
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js.map +1 -1
- package/dist/agent/agent-manager.d.ts +40 -1
- package/dist/agent/agent-manager.d.ts.map +1 -1
- package/dist/agent/agent-manager.js +172 -8
- package/dist/agent/agent-manager.js.map +1 -1
- package/dist/agent/types.d.ts +22 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/agent/wake.d.ts +15 -0
- package/dist/agent/wake.d.ts.map +1 -1
- package/dist/agent/wake.js +15 -0
- package/dist/agent/wake.js.map +1 -1
- package/dist/agent-detection/command-builder.d.ts +30 -0
- package/dist/agent-detection/command-builder.d.ts.map +1 -0
- package/dist/agent-detection/command-builder.js +71 -0
- package/dist/agent-detection/command-builder.js.map +1 -0
- package/dist/agent-detection/detector.d.ts +84 -0
- package/dist/agent-detection/detector.d.ts.map +1 -0
- package/dist/agent-detection/detector.js +240 -0
- package/dist/agent-detection/detector.js.map +1 -0
- package/dist/agent-detection/index.d.ts +12 -0
- package/dist/agent-detection/index.d.ts.map +1 -0
- package/dist/agent-detection/index.js +14 -0
- package/dist/agent-detection/index.js.map +1 -0
- package/dist/agent-detection/registry.d.ts +53 -0
- package/dist/agent-detection/registry.d.ts.map +1 -0
- package/dist/agent-detection/registry.js +177 -0
- package/dist/agent-detection/registry.js.map +1 -0
- package/dist/agent-detection/types.d.ts +121 -0
- package/dist/agent-detection/types.d.ts.map +1 -0
- package/dist/agent-detection/types.js +20 -0
- package/dist/agent-detection/types.js.map +1 -0
- package/dist/api/server.d.ts +5 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +362 -0
- package/dist/api/server.js.map +1 -1
- package/dist/api/types.d.ts +50 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/cli/acp.d.ts +2 -0
- package/dist/cli/acp.d.ts.map +1 -1
- package/dist/cli/acp.js +8 -1
- package/dist/cli/acp.js.map +1 -1
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.js +38 -0
- package/dist/cli/mcp.js.map +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/project-config.d.ts +46 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +68 -0
- package/dist/config/project-config.js.map +1 -0
- package/dist/lifecycle/cascade.d.ts +1 -1
- package/dist/lifecycle/cascade.d.ts.map +1 -1
- package/dist/lifecycle/handlers/index.d.ts +4 -0
- package/dist/lifecycle/handlers/index.d.ts.map +1 -1
- package/dist/lifecycle/handlers/index.js +2 -0
- package/dist/lifecycle/handlers/index.js.map +1 -1
- package/dist/lifecycle/handlers/worker.d.ts +4 -0
- package/dist/lifecycle/handlers/worker.d.ts.map +1 -1
- package/dist/lifecycle/handlers/worker.js +35 -3
- package/dist/lifecycle/handlers/worker.js.map +1 -1
- package/dist/mail/conversation-map.d.ts +33 -0
- package/dist/mail/conversation-map.d.ts.map +1 -0
- package/dist/mail/conversation-map.js +61 -0
- package/dist/mail/conversation-map.js.map +1 -0
- package/dist/mail/index.d.ts +11 -0
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +11 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/mail-service.d.ts +85 -0
- package/dist/mail/mail-service.d.ts.map +1 -0
- package/dist/mail/mail-service.js +121 -0
- package/dist/mail/mail-service.js.map +1 -0
- package/dist/mail/stores/eventstore-conversation-store.d.ts +40 -0
- package/dist/mail/stores/eventstore-conversation-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-conversation-store.js +131 -0
- package/dist/mail/stores/eventstore-conversation-store.js.map +1 -0
- package/dist/mail/stores/eventstore-participant-store.d.ts +43 -0
- package/dist/mail/stores/eventstore-participant-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-participant-store.js +145 -0
- package/dist/mail/stores/eventstore-participant-store.js.map +1 -0
- package/dist/mail/stores/eventstore-thread-store.d.ts +46 -0
- package/dist/mail/stores/eventstore-thread-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-thread-store.js +118 -0
- package/dist/mail/stores/eventstore-thread-store.js.map +1 -0
- package/dist/mail/stores/eventstore-turn-store.d.ts +47 -0
- package/dist/mail/stores/eventstore-turn-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-turn-store.js +153 -0
- package/dist/mail/stores/eventstore-turn-store.js.map +1 -0
- package/dist/mail/stores/index.d.ts +12 -0
- package/dist/mail/stores/index.d.ts.map +1 -0
- package/dist/mail/stores/index.js +12 -0
- package/dist/mail/stores/index.js.map +1 -0
- package/dist/mail/stores/types.d.ts +146 -0
- package/dist/mail/stores/types.d.ts.map +1 -0
- package/dist/mail/stores/types.js +13 -0
- package/dist/mail/stores/types.js.map +1 -0
- package/dist/mail/turn-recorder.d.ts +30 -0
- package/dist/mail/turn-recorder.d.ts.map +1 -0
- package/dist/mail/turn-recorder.js +98 -0
- package/dist/mail/turn-recorder.js.map +1 -0
- package/dist/map/adapter/acp-over-map.d.ts.map +1 -1
- package/dist/map/adapter/acp-over-map.js +32 -2
- package/dist/map/adapter/acp-over-map.js.map +1 -1
- package/dist/map/adapter/event-translator.d.ts.map +1 -1
- package/dist/map/adapter/event-translator.js +4 -0
- package/dist/map/adapter/event-translator.js.map +1 -1
- package/dist/map/adapter/extensions/agent-detection.d.ts +49 -0
- package/dist/map/adapter/extensions/agent-detection.d.ts.map +1 -0
- package/dist/map/adapter/extensions/agent-detection.js +91 -0
- package/dist/map/adapter/extensions/agent-detection.js.map +1 -0
- package/dist/map/adapter/extensions/index.d.ts +10 -1
- package/dist/map/adapter/extensions/index.d.ts.map +1 -1
- package/dist/map/adapter/extensions/index.js +39 -0
- package/dist/map/adapter/extensions/index.js.map +1 -1
- package/dist/map/adapter/extensions/resume.d.ts +47 -0
- package/dist/map/adapter/extensions/resume.d.ts.map +1 -0
- package/dist/map/adapter/extensions/resume.js +59 -0
- package/dist/map/adapter/extensions/resume.js.map +1 -0
- package/dist/map/adapter/extensions/workspace-files.d.ts +42 -0
- package/dist/map/adapter/extensions/workspace-files.d.ts.map +1 -0
- package/dist/map/adapter/extensions/workspace-files.js +338 -0
- package/dist/map/adapter/extensions/workspace-files.js.map +1 -0
- package/dist/map/adapter/mail-handler-adapter.d.ts +27 -0
- package/dist/map/adapter/mail-handler-adapter.d.ts.map +1 -0
- package/dist/map/adapter/mail-handler-adapter.js +292 -0
- package/dist/map/adapter/mail-handler-adapter.js.map +1 -0
- package/dist/map/adapter/map-adapter.d.ts +34 -10
- package/dist/map/adapter/map-adapter.d.ts.map +1 -1
- package/dist/map/adapter/map-adapter.js +110 -14
- package/dist/map/adapter/map-adapter.js.map +1 -1
- package/dist/map/adapter/rpc-handler.d.ts +4 -1
- package/dist/map/adapter/rpc-handler.d.ts.map +1 -1
- package/dist/map/adapter/rpc-handler.js +6 -0
- package/dist/map/adapter/rpc-handler.js.map +1 -1
- package/dist/map/index.d.ts +1 -0
- package/dist/map/index.d.ts.map +1 -1
- package/dist/map/index.js +2 -0
- package/dist/map/index.js.map +1 -1
- package/dist/map/types.d.ts +3 -1
- package/dist/map/types.d.ts.map +1 -1
- package/dist/map/types.js.map +1 -1
- package/dist/mcp/mcp-server.d.ts +6 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -1
- package/dist/mcp/mcp-server.js +45 -0
- package/dist/mcp/mcp-server.js.map +1 -1
- package/dist/mcp/tools/claim_task.d.ts +35 -0
- package/dist/mcp/tools/claim_task.d.ts.map +1 -0
- package/dist/mcp/tools/claim_task.js +58 -0
- package/dist/mcp/tools/claim_task.js.map +1 -0
- package/dist/mcp/tools/done.d.ts +15 -2
- package/dist/mcp/tools/done.d.ts.map +1 -1
- package/dist/mcp/tools/done.js +45 -10
- package/dist/mcp/tools/done.js.map +1 -1
- package/dist/mcp/tools/list_claimable_tasks.d.ts +38 -0
- package/dist/mcp/tools/list_claimable_tasks.d.ts.map +1 -0
- package/dist/mcp/tools/list_claimable_tasks.js +63 -0
- package/dist/mcp/tools/list_claimable_tasks.js.map +1 -0
- package/dist/mcp/tools/unclaim_task.d.ts +31 -0
- package/dist/mcp/tools/unclaim_task.d.ts.map +1 -0
- package/dist/mcp/tools/unclaim_task.js +47 -0
- package/dist/mcp/tools/unclaim_task.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +2 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/metrics.d.ts +79 -0
- package/dist/metrics/metrics.d.ts.map +1 -0
- package/dist/metrics/metrics.js +166 -0
- package/dist/metrics/metrics.js.map +1 -0
- package/dist/roles/capabilities.d.ts +1 -0
- package/dist/roles/capabilities.d.ts.map +1 -1
- package/dist/roles/capabilities.js +3 -0
- package/dist/roles/capabilities.js.map +1 -1
- package/dist/roles/types.d.ts +1 -1
- package/dist/roles/types.d.ts.map +1 -1
- package/dist/router/channels.d.ts +2 -4
- package/dist/router/channels.d.ts.map +1 -1
- package/dist/router/channels.js.map +1 -1
- package/dist/router/message-router.d.ts +85 -9
- package/dist/router/message-router.d.ts.map +1 -1
- package/dist/router/message-router.js +203 -14
- package/dist/router/message-router.js.map +1 -1
- package/dist/router/role-resolver.d.ts +10 -1
- package/dist/router/role-resolver.d.ts.map +1 -1
- package/dist/router/role-resolver.js +15 -1
- package/dist/router/role-resolver.js.map +1 -1
- package/dist/router/types.d.ts +30 -1
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/types.js.map +1 -1
- package/dist/server/combined-server.d.ts +6 -0
- package/dist/server/combined-server.d.ts.map +1 -1
- package/dist/server/combined-server.js +24 -2
- package/dist/server/combined-server.js.map +1 -1
- package/dist/store/event-store.d.ts +14 -1
- package/dist/store/event-store.d.ts.map +1 -1
- package/dist/store/event-store.js +456 -4
- package/dist/store/event-store.js.map +1 -1
- package/dist/store/types/agents.d.ts +1 -1
- package/dist/store/types/agents.d.ts.map +1 -1
- package/dist/store/types/conversations.d.ts +91 -0
- package/dist/store/types/conversations.d.ts.map +1 -0
- package/dist/store/types/conversations.js +8 -0
- package/dist/store/types/conversations.js.map +1 -0
- package/dist/store/types/events.d.ts +1 -1
- package/dist/store/types/events.d.ts.map +1 -1
- package/dist/store/types/events.js.map +1 -1
- package/dist/store/types/index.d.ts +2 -0
- package/dist/store/types/index.d.ts.map +1 -1
- package/dist/store/types/index.js +2 -0
- package/dist/store/types/index.js.map +1 -1
- package/dist/store/types/sessions.d.ts +44 -0
- package/dist/store/types/sessions.d.ts.map +1 -0
- package/dist/store/types/sessions.js +9 -0
- package/dist/store/types/sessions.js.map +1 -0
- package/dist/store/types/tasks.d.ts +2 -0
- package/dist/store/types/tasks.d.ts.map +1 -1
- package/dist/task/backend/memory.d.ts +4 -1
- package/dist/task/backend/memory.d.ts.map +1 -1
- package/dist/task/backend/memory.js +81 -0
- package/dist/task/backend/memory.js.map +1 -1
- package/dist/task/backend/types.d.ts +30 -0
- package/dist/task/backend/types.d.ts.map +1 -1
- package/dist/task/backend/types.js.map +1 -1
- package/dist/teams/index.d.ts +4 -0
- package/dist/teams/index.d.ts.map +1 -0
- package/dist/teams/index.js +4 -0
- package/dist/teams/index.js.map +1 -0
- package/dist/teams/team-loader.d.ts +20 -0
- package/dist/teams/team-loader.d.ts.map +1 -0
- package/dist/teams/team-loader.js +293 -0
- package/dist/teams/team-loader.js.map +1 -0
- package/dist/teams/team-runtime.d.ts +139 -0
- package/dist/teams/team-runtime.d.ts.map +1 -0
- package/dist/teams/team-runtime.js +613 -0
- package/dist/teams/team-runtime.js.map +1 -0
- package/dist/teams/types.d.ts +266 -0
- package/dist/teams/types.d.ts.map +1 -0
- package/dist/teams/types.js +20 -0
- package/dist/teams/types.js.map +1 -0
- package/dist/trigger/router/trigger-router.d.ts +30 -3
- package/dist/trigger/router/trigger-router.d.ts.map +1 -1
- package/dist/trigger/router/trigger-router.js +30 -3
- package/dist/trigger/router/trigger-router.js.map +1 -1
- package/dist/trigger/wake/types.d.ts +31 -5
- package/dist/trigger/wake/types.d.ts.map +1 -1
- package/dist/trigger/wake/types.js +19 -0
- package/dist/trigger/wake/types.js.map +1 -1
- package/dist/workspace/dataplane-adapter.d.ts +1 -1
- package/dist/workspace/dataplane-adapter.d.ts.map +1 -1
- package/dist/workspace/dataplane-adapter.js +1 -1
- package/dist/workspace/dataplane-adapter.js.map +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/strategies/index.d.ts +6 -0
- package/dist/workspace/strategies/index.d.ts.map +1 -0
- package/dist/workspace/strategies/index.js +5 -0
- package/dist/workspace/strategies/index.js.map +1 -0
- package/dist/workspace/strategies/optimistic.d.ts +26 -0
- package/dist/workspace/strategies/optimistic.d.ts.map +1 -0
- package/dist/workspace/strategies/optimistic.js +121 -0
- package/dist/workspace/strategies/optimistic.js.map +1 -0
- package/dist/workspace/strategies/queue.d.ts +26 -0
- package/dist/workspace/strategies/queue.d.ts.map +1 -0
- package/dist/workspace/strategies/queue.js +67 -0
- package/dist/workspace/strategies/queue.js.map +1 -0
- package/dist/workspace/strategies/registry.d.ts +37 -0
- package/dist/workspace/strategies/registry.d.ts.map +1 -0
- package/dist/workspace/strategies/registry.js +63 -0
- package/dist/workspace/strategies/registry.js.map +1 -0
- package/dist/workspace/strategies/trunk.d.ts +20 -0
- package/dist/workspace/strategies/trunk.d.ts.map +1 -0
- package/dist/workspace/strategies/trunk.js +108 -0
- package/dist/workspace/strategies/trunk.js.map +1 -0
- package/dist/workspace/strategies/types.d.ts +104 -0
- package/dist/workspace/strategies/types.d.ts.map +1 -0
- package/dist/workspace/strategies/types.js +11 -0
- package/dist/workspace/strategies/types.js.map +1 -0
- package/dist/workspace/types.d.ts +1 -1
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.d.ts +1 -1
- package/dist/workspace/workspace-manager.d.ts.map +1 -1
- package/docs/implementation-details.md +1127 -0
- package/docs/implementation-summary.md +448 -0
- package/docs/mail-integration.md +608 -0
- package/docs/plan-self-driving-support.md +433 -0
- package/docs/spec-self-driving-support.md +462 -0
- package/docs/team-templates.md +860 -0
- package/docs/teams.md +233 -0
- package/package.json +5 -3
- package/src/acp/__tests__/integration.test.ts +161 -1
- package/src/acp/__tests__/macro-agent.test.ts +95 -0
- package/src/acp/__tests__/session-persistence.test.ts +276 -0
- package/src/acp/macro-agent.ts +79 -7
- package/src/acp/session-mapper.ts +108 -1
- package/src/acp/types.ts +33 -1
- package/src/agent/agent-manager.ts +278 -6
- package/src/agent/types.ts +27 -0
- package/src/agent/wake.ts +15 -0
- package/src/agent-detection/__tests__/command-builder.test.ts +336 -0
- package/src/agent-detection/__tests__/detector.test.ts +768 -0
- package/src/agent-detection/__tests__/registry.test.ts +254 -0
- package/src/agent-detection/command-builder.ts +90 -0
- package/src/agent-detection/detector.ts +307 -0
- package/src/agent-detection/index.ts +36 -0
- package/src/agent-detection/registry.ts +200 -0
- package/src/agent-detection/types.ts +184 -0
- package/src/api/__tests__/conversation-api.test.ts +468 -0
- package/src/api/server.ts +425 -1
- package/src/api/types.ts +64 -1
- package/src/cli/acp.ts +9 -1
- package/src/cli/index.ts +44 -0
- package/src/cli/mcp.ts +47 -0
- package/src/config/index.ts +9 -0
- package/src/config/project-config.ts +107 -0
- package/src/lifecycle/cascade.ts +1 -1
- package/src/lifecycle/handlers/index.ts +8 -0
- package/src/lifecycle/handlers/worker.ts +48 -3
- package/src/mail/__tests__/conversation-lifecycle.test.ts +409 -0
- package/src/mail/__tests__/eventstore-stores.test.ts +1073 -0
- package/src/mail/__tests__/mail-full-agent.e2e.test.ts +575 -0
- package/src/mail/__tests__/mail-integration.test.ts +759 -0
- package/src/mail/__tests__/mail-map-protocol.e2e.test.ts +1068 -0
- package/src/mail/__tests__/mail-service.test.ts +506 -0
- package/src/mail/__tests__/turn-recorder.test.ts +328 -0
- package/src/mail/conversation-map.ts +107 -0
- package/src/mail/index.ts +25 -0
- package/src/mail/mail-service.ts +257 -0
- package/src/mail/stores/eventstore-conversation-store.ts +146 -0
- package/src/mail/stores/eventstore-participant-store.ts +172 -0
- package/src/mail/stores/eventstore-thread-store.ts +129 -0
- package/src/mail/stores/eventstore-turn-store.ts +173 -0
- package/src/mail/stores/index.ts +12 -0
- package/src/mail/stores/types.ts +160 -0
- package/src/mail/turn-recorder.ts +124 -0
- package/src/map/README.md +79 -0
- package/src/map/adapter/__tests__/extensions.test.ts +359 -0
- package/src/map/adapter/__tests__/map-adapter.test.ts +90 -0
- package/src/map/adapter/__tests__/workspace-files.test.ts +673 -0
- package/src/map/adapter/acp-over-map.ts +45 -2
- package/src/map/adapter/event-translator.ts +4 -0
- package/src/map/adapter/extensions/agent-detection.ts +201 -0
- package/src/map/adapter/extensions/index.ts +63 -0
- package/src/map/adapter/extensions/resume.ts +114 -0
- package/src/map/adapter/extensions/workspace-files.ts +449 -0
- package/src/map/adapter/mail-handler-adapter.ts +429 -0
- package/src/map/adapter/map-adapter.ts +173 -27
- package/src/map/adapter/rpc-handler.ts +8 -1
- package/src/map/index.ts +3 -0
- package/src/map/types.ts +3 -1
- package/src/mcp/mcp-server.ts +67 -0
- package/src/mcp/tools/claim_task.ts +86 -0
- package/src/mcp/tools/done.ts +59 -10
- package/src/mcp/tools/list_claimable_tasks.ts +93 -0
- package/src/mcp/tools/unclaim_task.ts +71 -0
- package/src/metrics/index.ts +9 -0
- package/src/metrics/metrics.ts +280 -0
- package/src/roles/capabilities.ts +3 -0
- package/src/roles/types.ts +2 -1
- package/src/router/README.md +120 -0
- package/src/router/__tests__/message-router.test.ts +561 -0
- package/src/router/channels.ts +3 -4
- package/src/router/message-router.ts +308 -22
- package/src/router/role-resolver.ts +22 -1
- package/src/router/types.ts +36 -1
- package/src/server/combined-server.ts +36 -2
- package/src/store/README.md +134 -0
- package/src/store/event-store.ts +546 -3
- package/src/store/types/agents.ts +1 -1
- package/src/store/types/conversations.ts +129 -0
- package/src/store/types/events.ts +5 -1
- package/src/store/types/index.ts +2 -0
- package/src/store/types/sessions.ts +53 -0
- package/src/store/types/tasks.ts +3 -0
- package/src/task/backend/memory.ts +116 -0
- package/src/task/backend/types.ts +43 -0
- package/src/teams/__tests__/cross-subsystem.integration.test.ts +983 -0
- package/src/teams/__tests__/e2e/team-runtime.e2e.test.ts +553 -0
- package/src/teams/__tests__/team-system.test.ts +1280 -0
- package/src/teams/index.ts +13 -0
- package/src/teams/team-loader.ts +434 -0
- package/src/teams/team-runtime.ts +727 -0
- package/src/teams/types.ts +377 -0
- package/src/trigger/router/trigger-router.ts +30 -3
- package/src/trigger/wake/types.ts +32 -5
- package/src/trigger/wake/wake-manager.ts +2 -2
- package/src/workspace/dataplane-adapter.ts +1 -1
- package/src/workspace/index.ts +1 -1
- package/src/workspace/strategies/index.ts +18 -0
- package/src/workspace/strategies/optimistic.ts +136 -0
- package/src/workspace/strategies/queue.ts +81 -0
- package/src/workspace/strategies/registry.ts +89 -0
- package/src/workspace/strategies/trunk.ts +123 -0
- package/src/workspace/strategies/types.ts +145 -0
- package/src/workspace/types.ts +1 -1
- package/src/workspace/workspace-manager.ts +1 -1
- package/.claude/settings.local.json +0 -59
- package/dist/map/utils/address-translation.d.ts +0 -99
- package/dist/map/utils/address-translation.d.ts.map +0 -1
- package/dist/map/utils/address-translation.js +0 -285
- package/dist/map/utils/address-translation.js.map +0 -1
- package/dist/map/utils/index.d.ts +0 -7
- package/dist/map/utils/index.d.ts.map +0 -1
- package/dist/map/utils/index.js +0 -7
- package/dist/map/utils/index.js.map +0 -1
- package/openspec/AGENTS.md +0 -456
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/design.md +0 -128
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/proposal.md +0 -49
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/agent-manager/spec.md +0 -150
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/cli-api/spec.md +0 -258
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/event-store/spec.md +0 -160
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/mcp-tools/spec.md +0 -224
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/message-router/spec.md +0 -153
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/task-manager/spec.md +0 -136
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/tasks.md +0 -147
- package/openspec/project.md +0 -31
- package/openspec/specs/agent-manager/spec.md +0 -154
- package/openspec/specs/cli-api/spec.md +0 -262
- package/openspec/specs/event-store/spec.md +0 -164
- package/openspec/specs/mcp-tools/spec.md +0 -228
- package/openspec/specs/message-router/spec.md +0 -157
- package/openspec/specs/task-manager/spec.md +0 -140
- package/references/acp-factory-ref/CHANGELOG.md +0 -33
- package/references/acp-factory-ref/LICENSE +0 -21
- package/references/acp-factory-ref/README.md +0 -341
- package/references/acp-factory-ref/package-lock.json +0 -3102
- package/references/acp-factory-ref/package.json +0 -96
- package/references/acp-factory-ref/python/CHANGELOG.md +0 -33
- package/references/acp-factory-ref/python/LICENSE +0 -21
- package/references/acp-factory-ref/python/Makefile +0 -57
- package/references/acp-factory-ref/python/README.md +0 -253
- package/references/acp-factory-ref/python/pyproject.toml +0 -73
- package/references/acp-factory-ref/python/tests/__init__.py +0 -0
- package/references/acp-factory-ref/python/tests/e2e/__init__.py +0 -1
- package/references/acp-factory-ref/python/tests/e2e/test_codex_e2e.py +0 -349
- package/references/acp-factory-ref/python/tests/e2e/test_gemini_e2e.py +0 -165
- package/references/acp-factory-ref/python/tests/e2e/test_opencode_e2e.py +0 -296
- package/references/acp-factory-ref/python/tests/test_client_handler.py +0 -543
- package/references/acp-factory-ref/python/tests/test_pushable.py +0 -199
- package/references/claude-code-acp/.github/workflows/ci.yml +0 -45
- package/references/claude-code-acp/.github/workflows/publish.yml +0 -34
- package/references/claude-code-acp/.prettierrc.json +0 -4
- package/references/claude-code-acp/CHANGELOG.md +0 -249
- package/references/claude-code-acp/LICENSE +0 -222
- package/references/claude-code-acp/README.md +0 -53
- package/references/claude-code-acp/docs/RELEASES.md +0 -24
- package/references/claude-code-acp/eslint.config.js +0 -48
- package/references/claude-code-acp/package-lock.json +0 -4570
- package/references/claude-code-acp/package.json +0 -88
- package/references/claude-code-acp/scripts/release.sh +0 -119
- package/references/claude-code-acp/src/acp-agent.ts +0 -2065
- package/references/claude-code-acp/src/index.ts +0 -26
- package/references/claude-code-acp/src/lib.ts +0 -38
- package/references/claude-code-acp/src/mcp-server.ts +0 -911
- package/references/claude-code-acp/src/settings.ts +0 -522
- package/references/claude-code-acp/src/tests/.claude/commands/quick-math.md +0 -5
- package/references/claude-code-acp/src/tests/.claude/commands/say-hello.md +0 -6
- package/references/claude-code-acp/src/tests/acp-agent-fork.test.ts +0 -479
- package/references/claude-code-acp/src/tests/acp-agent.test.ts +0 -1502
- package/references/claude-code-acp/src/tests/extract-lines.test.ts +0 -103
- package/references/claude-code-acp/src/tests/fork-session.test.ts +0 -335
- package/references/claude-code-acp/src/tests/replace-and-calculate-location.test.ts +0 -334
- package/references/claude-code-acp/src/tests/settings.test.ts +0 -617
- package/references/claude-code-acp/src/tests/skills-options.test.ts +0 -187
- package/references/claude-code-acp/src/tests/tools.test.ts +0 -318
- package/references/claude-code-acp/src/tests/typescript-declarations.test.ts +0 -558
- package/references/claude-code-acp/src/tools.ts +0 -819
- package/references/claude-code-acp/src/utils.ts +0 -171
- package/references/claude-code-acp/tsconfig.json +0 -18
- package/references/claude-code-acp/vitest.config.ts +0 -19
- package/references/multi-agent-protocol/.sudocode/issues.jsonl +0 -82
- package/references/multi-agent-protocol/.sudocode/specs.jsonl +0 -9
- package/references/multi-agent-protocol/LICENSE +0 -21
- package/references/multi-agent-protocol/README.md +0 -113
- package/references/multi-agent-protocol/docs/00-design-specification.md +0 -460
- package/references/multi-agent-protocol/docs/01-open-questions.md +0 -1050
- package/references/multi-agent-protocol/docs/02-wire-protocol.md +0 -296
- package/references/multi-agent-protocol/docs/03-streaming-semantics.md +0 -252
- package/references/multi-agent-protocol/docs/04-error-handling.md +0 -231
- package/references/multi-agent-protocol/docs/05-connection-model.md +0 -244
- package/references/multi-agent-protocol/docs/06-visibility-permissions.md +0 -243
- package/references/multi-agent-protocol/docs/07-federation.md +0 -259
- package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +0 -253
- package/references/multi-agent-protocol/package-lock.json +0 -3239
- package/references/multi-agent-protocol/package.json +0 -56
- package/references/multi-agent-protocol/schema/meta.json +0 -337
- package/references/multi-agent-protocol/schema/schema.json +0 -1828
package/CLAUDE.md
CHANGED
|
@@ -5,11 +5,16 @@ A multi-agent orchestration system for spawning and managing hierarchical Claude
|
|
|
5
5
|
## Project Overview
|
|
6
6
|
|
|
7
7
|
macro-agent enables coordinated work across multiple AI agents with:
|
|
8
|
-
- **Role-based agents** (Worker, Integrator, Coordinator, Monitor)
|
|
8
|
+
- **Role-based agents** (Worker, Integrator, Coordinator, Monitor + custom team roles)
|
|
9
|
+
- **Team templates** for declarative multi-agent topologies (YAML config)
|
|
10
|
+
- **Pluggable integration strategies** (queue, trunk, optimistic)
|
|
9
11
|
- **Workspace isolation** via git worktrees
|
|
10
12
|
- **Merge queue** for serialized integration
|
|
11
|
-
- **Task backend** abstraction (memory or sudocode)
|
|
13
|
+
- **Task backend** abstraction (memory or sudocode) with push and pull modes
|
|
12
14
|
- **In-flight steering** via context injection
|
|
15
|
+
- **Signal filtering and emission enforcement** for communication topology
|
|
16
|
+
- **Session continuations** for long-running daemon agents
|
|
17
|
+
- **Observability** via throughput, utilization, and error metrics
|
|
13
18
|
|
|
14
19
|
## Architecture
|
|
15
20
|
|
|
@@ -20,10 +25,18 @@ macro-agent enables coordinated work across multiple AI agents with:
|
|
|
20
25
|
└───────────────────────────┬─────────────────────────────────┘
|
|
21
26
|
│
|
|
22
27
|
┌───────────────────────────▼─────────────────────────────────┐
|
|
28
|
+
│ Team Runtime (optional) │
|
|
29
|
+
│ - Loads team YAML config (topology, communication) │
|
|
30
|
+
│ - Bootstraps root + companion agents │
|
|
31
|
+
│ - Installs spawn interceptor, signal filters, validators │
|
|
32
|
+
│ - Manages integration strategy and session continuations │
|
|
33
|
+
└───────────────────────────┬─────────────────────────────────┘
|
|
34
|
+
│
|
|
35
|
+
┌───────────────────────────▼─────────────────────────────────┐
|
|
23
36
|
│ Agent Manager │
|
|
24
37
|
│ - Spawns agents via acp-factory │
|
|
25
|
-
│ - Manages lifecycle (spawn, prompt, stop)
|
|
26
|
-
│ -
|
|
38
|
+
│ - Manages lifecycle (spawn, prompt, stop, continue) │
|
|
39
|
+
│ - Spawn interception for team role/topic injection │
|
|
27
40
|
└───────────────────────────┬─────────────────────────────────┘
|
|
28
41
|
│
|
|
29
42
|
┌───────────────────┼───────────────────┐
|
|
@@ -31,10 +44,11 @@ macro-agent enables coordinated work across multiple AI agents with:
|
|
|
31
44
|
▼ ▼ ▼
|
|
32
45
|
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
33
46
|
│ Roles │ │ Workspace │ │ Tasks │
|
|
34
|
-
│
|
|
35
|
-
│
|
|
36
|
-
│
|
|
37
|
-
│
|
|
47
|
+
│ Built-in + │ │ Bare Repo │ │ Backend │
|
|
48
|
+
│ Team-defined│ │ Worktrees │ │ (memory/ │
|
|
49
|
+
│ (via YAML) │ │ Strategies │ │ sudocode) │
|
|
50
|
+
│ │ │ (queue/ │ │ Push/Pull │
|
|
51
|
+
│ │ │ trunk/opt) │ │ modes │
|
|
38
52
|
└──────────────┘ └──────────────┘ └──────────────┘
|
|
39
53
|
│ │ │
|
|
40
54
|
└───────────────────┼───────────────────┘
|
|
@@ -43,7 +57,8 @@ macro-agent enables coordinated work across multiple AI agents with:
|
|
|
43
57
|
│ Message Router │
|
|
44
58
|
│ - MAP addressing (agent, role, scope, parent/child) │
|
|
45
59
|
│ - sendToAddress() for all message routing │
|
|
46
|
-
│ -
|
|
60
|
+
│ - Topic-based status routing with signal filtering │
|
|
61
|
+
│ - Emission validation (strict/permissive/audit) │
|
|
47
62
|
│ - Activity waking for sleeping agents │
|
|
48
63
|
└───────────────────────────┬─────────────────────────────────┘
|
|
49
64
|
│
|
|
@@ -51,7 +66,7 @@ macro-agent enables coordinated work across multiple AI agents with:
|
|
|
51
66
|
│ Event Store │
|
|
52
67
|
│ - Append-only event log (SQLite) │
|
|
53
68
|
│ - Materialized views for queries │
|
|
54
|
-
│ - Agents, tasks, messages, events
|
|
69
|
+
│ - Agents, tasks, messages, events, team config │
|
|
55
70
|
└─────────────────────────────────────────────────────────────┘
|
|
56
71
|
```
|
|
57
72
|
|
|
@@ -65,34 +80,43 @@ src/
|
|
|
65
80
|
│ └── session-mapper.ts # Session → Agent ID mapping
|
|
66
81
|
│
|
|
67
82
|
├── agent/ # Agent lifecycle
|
|
68
|
-
│ ├── agent-manager.ts # Spawn, prompt, stop agents
|
|
83
|
+
│ ├── agent-manager.ts # Spawn, prompt, stop, continue agents
|
|
69
84
|
│ ├── wake.ts # Wake sleeping agents
|
|
70
85
|
│ └── system-prompt.ts # Agent system prompts
|
|
71
86
|
│
|
|
72
87
|
├── api/ # REST API
|
|
73
|
-
│ ├── server.ts # Express routes
|
|
88
|
+
│ ├── server.ts # Express routes (agents, tasks, team, metrics)
|
|
74
89
|
│ └── types.ts # Request/response types
|
|
75
90
|
│
|
|
76
91
|
├── cli/ # Command-line interface
|
|
77
|
-
│ └── index.ts # CLI commands (start, chat, status)
|
|
92
|
+
│ └── index.ts # CLI commands (start, chat, status, --team)
|
|
93
|
+
│
|
|
94
|
+
├── config/ # Project configuration
|
|
95
|
+
│ └── project-config.ts # .macro-agent/config.json loader
|
|
78
96
|
│
|
|
79
97
|
├── lifecycle/ # Agent lifecycle management
|
|
80
98
|
│ ├── handlers/ # Role-specific done() handlers
|
|
81
|
-
│ │ ├── worker.ts # Worker completion (
|
|
99
|
+
│ │ ├── worker.ts # Worker completion (strategy dispatch)
|
|
82
100
|
│ │ ├── integrator.ts # Integrator completion (merge queue)
|
|
83
101
|
│ │ └── monitor.ts # Monitor completion (health reporting)
|
|
84
102
|
│ ├── cascade.ts # Cascade termination
|
|
85
103
|
│ └── cleanup.ts # Workspace cleanup helpers
|
|
86
104
|
│
|
|
87
105
|
├── mcp/ # Model Context Protocol
|
|
88
|
-
│ ├── mcp-server.ts # Per-agent MCP server
|
|
106
|
+
│ ├── mcp-server.ts # Per-agent MCP server (role-based tool filtering)
|
|
89
107
|
│ └── tools/ # MCP tool implementations
|
|
90
108
|
│ ├── done.ts # Generalized done() tool
|
|
91
|
-
│
|
|
109
|
+
│ ├── inject_context.ts # Context injection tool
|
|
110
|
+
│ ├── claim_task.ts # Claim task from pool (pull mode)
|
|
111
|
+
│ ├── unclaim_task.ts # Release claimed task (pull mode)
|
|
112
|
+
│ └── list_claimable_tasks.ts # List available tasks (pull mode)
|
|
113
|
+
│
|
|
114
|
+
├── metrics/ # Observability
|
|
115
|
+
│ └── metrics.ts # Throughput, utilization, error metrics
|
|
92
116
|
│
|
|
93
117
|
├── roles/ # Role system
|
|
94
118
|
│ ├── types.ts # RoleDefinition, Capability types
|
|
95
|
-
│ ├── capabilities.ts # Capability constants
|
|
119
|
+
│ ├── capabilities.ts # Capability constants (incl. task.claim)
|
|
96
120
|
│ ├── registry.ts # Role registry with resolution
|
|
97
121
|
│ └── builtin/ # Built-in role definitions
|
|
98
122
|
│ ├── worker.ts
|
|
@@ -101,10 +125,10 @@ src/
|
|
|
101
125
|
│ └── monitor.ts
|
|
102
126
|
│
|
|
103
127
|
├── router/ # Message routing
|
|
104
|
-
│ ├── message-router.ts # Core router with
|
|
128
|
+
│ ├── message-router.ts # Core router with signal filtering + emission validation
|
|
105
129
|
│ ├── broadcast.ts # Broadcast channel (fan-out)
|
|
106
130
|
│ ├── role-resolver.ts # Role → Agent resolution
|
|
107
|
-
│ ├── wake.ts # Activity waking
|
|
131
|
+
│ ├── wake.ts # Activity waking (status + message)
|
|
108
132
|
│ └── types.ts # Message, Channel types
|
|
109
133
|
│
|
|
110
134
|
├── steering/ # In-flight steering
|
|
@@ -126,22 +150,42 @@ src/
|
|
|
126
150
|
├── task/ # Task management
|
|
127
151
|
│ ├── task-manager.ts # Legacy task manager
|
|
128
152
|
│ └── backend/ # Pluggable task backends
|
|
129
|
-
│ ├── types.ts # TaskBackend interface
|
|
130
|
-
│ ├── memory.ts # InMemoryTaskBackend
|
|
153
|
+
│ ├── types.ts # TaskBackend interface (+ claim/unclaim/listClaimable)
|
|
154
|
+
│ ├── memory.ts # InMemoryTaskBackend (push + pull)
|
|
131
155
|
│ ├── tool-provider.ts # Task MCP tools
|
|
132
156
|
│ └── sudocode/ # Sudocode integration
|
|
133
157
|
│
|
|
158
|
+
├── teams/ # Team template system
|
|
159
|
+
│ ├── types.ts # TeamManifest, TeamTopology, TeamCommunication
|
|
160
|
+
│ ├── team-loader.ts # YAML loading, role resolution, validation
|
|
161
|
+
│ ├── team-runtime.ts # Initialize, bootstrap, peer routing, signal filtering
|
|
162
|
+
│ └── index.ts # Public exports
|
|
163
|
+
│
|
|
134
164
|
└── workspace/ # Workspace isolation
|
|
135
165
|
├── workspace-manager.ts # Worktree management
|
|
136
166
|
├── config.ts # Workspace configuration
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
167
|
+
├── merge-queue/ # Merge queue
|
|
168
|
+
│ ├── merge-queue.ts # SQLite-backed queue
|
|
169
|
+
│ ├── types.ts # Queue types
|
|
170
|
+
│ └── schema.ts # Database schema
|
|
171
|
+
└── strategies/ # Integration strategies
|
|
172
|
+
├── types.ts # IntegrationStrategy interface
|
|
173
|
+
├── registry.ts # Strategy factory registry
|
|
174
|
+
├── queue.ts # Queue strategy (wraps merge queue)
|
|
175
|
+
├── trunk.ts # Trunk strategy (direct push + rebase)
|
|
176
|
+
└── optimistic.ts # Optimistic strategy (push + validation event)
|
|
141
177
|
```
|
|
142
178
|
|
|
143
179
|
## Key Concepts
|
|
144
180
|
|
|
181
|
+
### Teams
|
|
182
|
+
|
|
183
|
+
Teams are declarative YAML configurations that define multi-agent topologies:
|
|
184
|
+
- **TeamLoader** (`team-loader.ts`): Parses `team.yaml`, resolves role inheritance, validates topology
|
|
185
|
+
- **TeamRuntime** (`team-runtime.ts`): Wires team config into running services (roles, spawn interceptor, peer routing, signal filtering, emission validation, continuation monitoring)
|
|
186
|
+
- Teams compose on top of existing primitives — no team loaded = identical behavior to pre-team codebase
|
|
187
|
+
- Team config is shared across processes via EventStore `team_config` event
|
|
188
|
+
|
|
145
189
|
### Roles
|
|
146
190
|
|
|
147
191
|
Agents are assigned roles that determine their capabilities:
|
|
@@ -153,18 +197,40 @@ Agents are assigned roles that determine their capabilities:
|
|
|
153
197
|
| **Coordinator** | Orchestrate workers and manage tasks | Spawn agents, assign tasks, broadcast |
|
|
154
198
|
| **Monitor** | Health monitoring and alerts | Read-only access, activity watching |
|
|
155
199
|
|
|
200
|
+
Teams can define custom roles (e.g., planner, grinder, judge) that extend built-in roles via `extends` in `roles/<name>.yaml`. Custom roles can add/remove capabilities and provide custom prompts.
|
|
201
|
+
|
|
202
|
+
### Integration Strategies
|
|
203
|
+
|
|
204
|
+
Pluggable strategies for landing worker changes:
|
|
205
|
+
- **Queue** (`queue.ts`): Wraps merge queue with serialized integration
|
|
206
|
+
- **Trunk** (`trunk.ts`): Direct push with rebase-retry loop, configurable `conflictAction`
|
|
207
|
+
- **Optimistic** (`optimistic.ts`): Same as trunk + emits `validation:requested` event
|
|
208
|
+
|
|
209
|
+
Strategy is set per-team in `team.yaml` under `macro_agent.integration.strategy`.
|
|
210
|
+
|
|
156
211
|
### Workspace Isolation
|
|
157
212
|
|
|
158
213
|
Each worker gets an isolated git worktree:
|
|
159
214
|
- Workers operate on feature branches
|
|
160
|
-
- Changes merge through the queue
|
|
215
|
+
- Changes merge through the queue or strategy
|
|
161
216
|
- Conflicts detected and resolved by integrator
|
|
162
217
|
|
|
163
218
|
### Task Backend
|
|
164
219
|
|
|
165
220
|
Two backends available:
|
|
166
|
-
- **memory**: In-memory tasks with EventStore persistence
|
|
167
|
-
- **sudocode**: External issue tracking with dependency management
|
|
221
|
+
- **memory**: In-memory tasks with EventStore persistence (supports push + pull modes)
|
|
222
|
+
- **sudocode**: External issue tracking with dependency management (push mode only)
|
|
223
|
+
|
|
224
|
+
Pull mode adds `claim_task`, `unclaim_task`, `list_claimable_tasks` MCP tools (gated by `task.claim` capability).
|
|
225
|
+
|
|
226
|
+
### Communication Topology
|
|
227
|
+
|
|
228
|
+
Teams configure non-hierarchical communication via:
|
|
229
|
+
- **Channels**: Named topics (e.g., `work_coordination`, `task_updates`) with defined signals
|
|
230
|
+
- **Subscriptions**: Per-role channel subscriptions with optional signal filters
|
|
231
|
+
- **Peer routing**: Directional connections between roles (`via: direct|topic|scope`) with per-peer signal filters
|
|
232
|
+
- **Emissions**: Per-role allowed signal lists, enforced by emission validator
|
|
233
|
+
- **Enforcement**: `strict` (reject violations), `permissive` (warn), `audit` (record to EventStore)
|
|
168
234
|
|
|
169
235
|
### Context Injection
|
|
170
236
|
|
|
@@ -188,6 +254,17 @@ Inject context into running agents:
|
|
|
188
254
|
- **kebab-case** for file names
|
|
189
255
|
- **SCREAMING_SNAKE** for constants
|
|
190
256
|
|
|
257
|
+
#### ID Field Naming Convention
|
|
258
|
+
|
|
259
|
+
Different layers use different naming for ID fields by design:
|
|
260
|
+
|
|
261
|
+
| Layer | Convention | Example | Rationale |
|
|
262
|
+
|-------|------------|---------|-----------|
|
|
263
|
+
| **Internal** (store, router, activity) | `agent_id`, `task_id` | `source.agent_id` | Database/event conventions, explicit |
|
|
264
|
+
| **MAP Protocol** (map/types) | `agent`, `task` | `address.agent` | Protocol spec, cleaner syntax |
|
|
265
|
+
|
|
266
|
+
The `store/types/events.ts` module bridges these conventions when converting between internal events and MAP addresses.
|
|
267
|
+
|
|
191
268
|
### Testing
|
|
192
269
|
|
|
193
270
|
- **Unit tests**: `*.test.ts` - Fast, mocked dependencies
|
|
@@ -215,13 +292,20 @@ npm run test:e2e # E2E tests (requires RUN_E2E_TESTS=true)
|
|
|
215
292
|
3. Export tool info and handler
|
|
216
293
|
4. Register in `src/mcp/mcp-server.ts`
|
|
217
294
|
|
|
218
|
-
### Adding a New Role
|
|
295
|
+
### Adding a New Built-in Role
|
|
219
296
|
|
|
220
297
|
1. Create `src/roles/builtin/your_role.ts`
|
|
221
298
|
2. Define `RoleDefinition` with capabilities
|
|
222
299
|
3. Add enforcement implementations
|
|
223
300
|
4. Register in `src/roles/builtin/index.ts`
|
|
224
301
|
|
|
302
|
+
### Adding a Team Role (via YAML)
|
|
303
|
+
|
|
304
|
+
1. Create `.macro-agent/teams/<team>/roles/<role>.yaml` with `extends` base role
|
|
305
|
+
2. Add `capabilities_add`/`capabilities_remove` as needed
|
|
306
|
+
3. Create `.macro-agent/teams/<team>/prompts/<role>.md` for custom prompt
|
|
307
|
+
4. Reference the role in `team.yaml` topology and communication sections
|
|
308
|
+
|
|
225
309
|
### Modifying Task Backend
|
|
226
310
|
|
|
227
311
|
1. Update interface in `src/task/backend/types.ts`
|
|
@@ -236,10 +320,17 @@ npm run test:e2e # E2E tests (requires RUN_E2E_TESTS=true)
|
|
|
236
320
|
| `SUDOCODE_PROJECT_PATH` | Path to sudocode project | `cwd` |
|
|
237
321
|
| `MACRO_WORKSPACE_POOL_SIZE` | Max concurrent workspaces | `10` |
|
|
238
322
|
| `MACRO_MERGE_QUEUE_DB` | Merge queue SQLite path | `:memory:` |
|
|
323
|
+
| `MACRO_TEAM_NAME` | Team name (injected into agent env by team runtime) | — |
|
|
324
|
+
| `MACRO_TASK_MODE` | Task mode: `push` or `pull` (injected by team runtime) | — |
|
|
325
|
+
| `MACRO_INTEGRATION_STRATEGY` | Integration strategy name (injected by team runtime) | — |
|
|
326
|
+
| `MACRO_INSTANCE_ID` | EventStore instance ID (for MCP subprocess access) | — |
|
|
327
|
+
| `MACRO_BASE_DIR` | EventStore base directory (for MCP subprocess access) | — |
|
|
239
328
|
|
|
240
329
|
## References
|
|
241
330
|
|
|
242
331
|
- [README.md](README.md) - User-facing documentation
|
|
243
|
-
- [docs/sudocode-integration.md](docs/sudocode-integration.md) - Sudocode backend details
|
|
244
332
|
- [docs/architecture.md](docs/architecture.md) - Full architecture documentation
|
|
245
333
|
- [docs/configuration.md](docs/configuration.md) - Configuration reference
|
|
334
|
+
- [docs/teams.md](docs/teams.md) - Team template schema reference
|
|
335
|
+
- [docs/team-templates.md](docs/team-templates.md) - Team template format and examples
|
|
336
|
+
- [docs/sudocode-integration.md](docs/sudocode-integration.md) - Sudocode backend details
|
package/README.md
CHANGED
|
@@ -6,14 +6,19 @@ A multi-agent orchestration system for spawning and managing hierarchical Claude
|
|
|
6
6
|
|
|
7
7
|
- **Hierarchical Agent Management** - Head manager spawns and coordinates child agents
|
|
8
8
|
- **Role-Based Agents** - Worker, Integrator, Coordinator, and Monitor roles with distinct capabilities
|
|
9
|
+
- **Team Templates** - Declarative YAML-based team configurations for multi-agent topologies
|
|
10
|
+
- **Pluggable Integration Strategies** - Queue, trunk, or optimistic merge strategies
|
|
9
11
|
- **Workspace Isolation** - Each worker gets isolated git worktrees to prevent conflicts
|
|
10
12
|
- **Merge Queue** - Serialized integration of worker changes with conflict resolution
|
|
11
13
|
- **Event-Sourced State** - All state changes persisted via append-only event log
|
|
12
14
|
- **Real-time Communication** - WebSocket subscriptions for live updates
|
|
13
15
|
- **MCP Tool Integration** - Agents communicate via Model Context Protocol tools
|
|
14
|
-
- **Task Lifecycle** - Create, assign, and track tasks
|
|
15
|
-
- **Message Routing** - Direct, broadcast, and
|
|
16
|
+
- **Task Lifecycle** - Create, assign, and track tasks with push or pull models
|
|
17
|
+
- **Message Routing** - Direct, broadcast, role-based, and topic-based message delivery with priority
|
|
18
|
+
- **Signal Filtering** - Per-role and per-peer signal filtering for status notifications
|
|
16
19
|
- **Context Injection** - Push context into running agents without waiting for message checks
|
|
20
|
+
- **Session Continuations** - Auto-resume long-running agents across process restarts
|
|
21
|
+
- **Observability** - Throughput, utilization, and error metrics via REST API
|
|
17
22
|
- **Sudocode Integration** - Optional issue tracking with dependency management
|
|
18
23
|
|
|
19
24
|
## Sudocode Integration
|
|
@@ -37,6 +42,44 @@ With sudocode enabled:
|
|
|
37
42
|
|
|
38
43
|
See [docs/sudocode-integration.md](docs/sudocode-integration.md) for full documentation.
|
|
39
44
|
|
|
45
|
+
## Team Templates
|
|
46
|
+
|
|
47
|
+
Teams define multi-agent topologies as YAML configuration. A team template specifies which roles to spawn, how they communicate, and what integration strategy to use.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Start with a team template
|
|
51
|
+
npx multiagent --team self-driving
|
|
52
|
+
|
|
53
|
+
# Or set in project config (.macro-agent/config.json)
|
|
54
|
+
echo '{ "team": "self-driving" }' > .macro-agent/config.json
|
|
55
|
+
npx multiagent
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Teams are stored in `.macro-agent/teams/<name>/`:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
.macro-agent/teams/self-driving/
|
|
62
|
+
├── team.yaml # Team manifest (topology, communication, strategy)
|
|
63
|
+
├── roles/
|
|
64
|
+
│ ├── planner.yaml # Custom role (extends coordinator)
|
|
65
|
+
│ ├── grinder.yaml # Custom role (extends worker)
|
|
66
|
+
│ └── judge.yaml # Custom role (extends monitor)
|
|
67
|
+
└── prompts/
|
|
68
|
+
├── planner.md # Role-specific system prompt
|
|
69
|
+
├── grinder.md
|
|
70
|
+
└── judge.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Key team features:
|
|
74
|
+
- **Topology**: Root + companion agents spawned at bootstrap, with spawn rules for dynamic workers
|
|
75
|
+
- **Communication**: Topic-based channels with per-role signal filtering, peer-to-peer routing
|
|
76
|
+
- **Integration strategies**: `queue` (merge queue), `trunk` (direct push with rebase), `optimistic` (push + validation)
|
|
77
|
+
- **Task modes**: `push` (coordinator assigns) or `pull` (agents claim from pool)
|
|
78
|
+
- **Enforcement**: `strict` (reject violations), `permissive` (warn), or `audit` (record)
|
|
79
|
+
- **Session continuations**: Auto-resume daemon agents on unexpected stops
|
|
80
|
+
|
|
81
|
+
See [docs/teams.md](docs/teams.md) for the full schema reference and [docs/team-templates.md](docs/team-templates.md) for examples.
|
|
82
|
+
|
|
40
83
|
## Installation
|
|
41
84
|
|
|
42
85
|
```bash
|
|
@@ -51,6 +94,9 @@ npm install macro-agent
|
|
|
51
94
|
# Start full server with ACP + MAP + REST API
|
|
52
95
|
npx multiagent
|
|
53
96
|
|
|
97
|
+
# Start with a team template
|
|
98
|
+
npx multiagent --team self-driving
|
|
99
|
+
|
|
54
100
|
# Custom port and host
|
|
55
101
|
npx multiagent --port 8080 --host 0.0.0.0
|
|
56
102
|
```
|
|
@@ -224,6 +270,10 @@ Fallback chain: `inject()` → `interruptWith()` → high-priority message
|
|
|
224
270
|
| `/api/events` | GET | List events |
|
|
225
271
|
| `/api/conversation/message` | POST | Send message |
|
|
226
272
|
| `/api/conversation/history` | GET | Get history |
|
|
273
|
+
| `/api/team` | GET | Active team info |
|
|
274
|
+
| `/api/metrics/throughput` | GET | Task completion rates |
|
|
275
|
+
| `/api/metrics/utilization` | GET | Agent counts by role/state |
|
|
276
|
+
| `/api/metrics/errors` | GET | Error tracking |
|
|
227
277
|
|
|
228
278
|
### WebSocket Channels
|
|
229
279
|
|
|
@@ -237,7 +287,7 @@ Fallback chain: `inject()` → `interruptWith()` → high-priority message
|
|
|
237
287
|
| Tool | Description |
|
|
238
288
|
|------|-------------|
|
|
239
289
|
| `spawn_agent` | Spawn a child agent |
|
|
240
|
-
| `emit_status` | Report status
|
|
290
|
+
| `emit_status` | Report status (with signal filtering and emission validation) |
|
|
241
291
|
| `send_message` | Send message to another agent |
|
|
242
292
|
| `check_messages` | Check message inbox |
|
|
243
293
|
| `get_hierarchy` | View agent tree |
|
|
@@ -246,6 +296,9 @@ Fallback chain: `inject()` → `interruptWith()` → high-priority message
|
|
|
246
296
|
| `create_task` | Create a new task |
|
|
247
297
|
| `get_task` | Get task details |
|
|
248
298
|
| `list_ready_tasks` | List tasks with no blockers |
|
|
299
|
+
| `claim_task` | Claim next available task (pull mode) |
|
|
300
|
+
| `unclaim_task` | Return claimed task to pool (pull mode) |
|
|
301
|
+
| `list_claimable_tasks` | List claimable tasks (pull mode) |
|
|
249
302
|
| `done` | Signal task completion (role-specific) |
|
|
250
303
|
| `inject_context` | Inject context into another agent |
|
|
251
304
|
| `wait_for_activity` | Wait for system events (Monitor) |
|
|
@@ -279,6 +332,7 @@ npx multiagent --acp --cwd /path/to/project
|
|
|
279
332
|
| `--port <port>` | Server port (default: 3001) |
|
|
280
333
|
| `--host <host>` | Server host (default: localhost) |
|
|
281
334
|
| `--cwd <path>` | Working directory for agents |
|
|
335
|
+
| `--team <name>` | Load team template from `.macro-agent/teams/<name>/` |
|
|
282
336
|
| `--acp` | Stdio ACP-only mode (for embedded use with acp-factory) |
|
|
283
337
|
|
|
284
338
|
### Multi-Client Architecture
|
|
@@ -344,6 +398,7 @@ multiagent [options] Start the agent server (full mode by default)
|
|
|
344
398
|
--port <port> Port (default: 3001)
|
|
345
399
|
--host <host> Host (default: localhost)
|
|
346
400
|
--cwd <path> Working directory
|
|
401
|
+
--team <name> Load team template
|
|
347
402
|
--acp Stdio ACP-only mode (for acp-factory)
|
|
348
403
|
```
|
|
349
404
|
|
|
@@ -397,6 +452,8 @@ RUN_E2E_TESTS=true ANTHROPIC_API_KEY=xxx npm run test:e2e
|
|
|
397
452
|
|
|
398
453
|
- [Architecture Overview](docs/architecture.md) - Full system architecture
|
|
399
454
|
- [Configuration Reference](docs/configuration.md) - Environment variables and config options
|
|
455
|
+
- [Team Templates](docs/team-templates.md) - Team template format and examples
|
|
456
|
+
- [Team Schema Reference](docs/teams.md) - Full YAML schema reference
|
|
400
457
|
- [Sudocode Integration](docs/sudocode-integration.md) - External issue tracking
|
|
401
458
|
- [Troubleshooting Guide](docs/troubleshooting.md) - Common issues and solutions
|
|
402
459
|
|
|
@@ -169,6 +169,10 @@ export declare class MacroAgent implements Agent {
|
|
|
169
169
|
* then calls the agent manager to cancel the pending permission.
|
|
170
170
|
*/
|
|
171
171
|
private handleCancelPermission;
|
|
172
|
+
/**
|
|
173
|
+
* Resume a stopped/failed agent
|
|
174
|
+
*/
|
|
175
|
+
private handleResumeAgent;
|
|
172
176
|
/**
|
|
173
177
|
* Extract text content from prompt content blocks
|
|
174
178
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macro-agent.d.ts","sourceRoot":"","sources":["../../src/acp/macro-agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EACV,YAAY,EAYZ,oBAAoB,
|
|
1
|
+
{"version":3,"file":"macro-agent.d.ts","sourceRoot":"","sources":["../../src/acp/macro-agent.ts"],"names":[],"mappings":"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"}
|
package/dist/acp/macro-agent.js
CHANGED
|
@@ -28,6 +28,7 @@ const SUPPORTED_EXTENSIONS = [
|
|
|
28
28
|
"_macro/checkCapability",
|
|
29
29
|
"_macro/respondToPermission",
|
|
30
30
|
"_macro/cancelPermission",
|
|
31
|
+
"_macro/resume",
|
|
31
32
|
];
|
|
32
33
|
// ─────────────────────────────────────────────────────────────────
|
|
33
34
|
// MacroAgent Implementation
|
|
@@ -58,8 +59,13 @@ export class MacroAgent {
|
|
|
58
59
|
this.peerManager = config.peerManager;
|
|
59
60
|
this.capabilityManager = config.capabilityManager;
|
|
60
61
|
this.roleRegistry = config.roleRegistry ?? new DefaultRoleRegistry();
|
|
61
|
-
this.sessionMapper = new SessionMapper();
|
|
62
|
+
this.sessionMapper = new SessionMapper(config.eventStore);
|
|
62
63
|
this.defaultCwd = config.defaultCwd ?? process.cwd();
|
|
64
|
+
// Recover persisted sessions from the EventStore
|
|
65
|
+
const recovered = this.sessionMapper.recoverFromStore();
|
|
66
|
+
if (recovered > 0) {
|
|
67
|
+
console.log(`[MacroAgent] Recovered ${recovered} session(s) from EventStore`);
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
70
|
// ─────────────────────────────────────────────────────────────────
|
|
65
71
|
// Core ACP Methods
|
|
@@ -121,8 +127,21 @@ export class MacroAgent {
|
|
|
121
127
|
* Load an existing session from EventStore
|
|
122
128
|
*/
|
|
123
129
|
async loadSession(params) {
|
|
124
|
-
|
|
130
|
+
let acpSessionId = params.sessionId;
|
|
125
131
|
const cwd = params.cwd ?? this.defaultCwd;
|
|
132
|
+
// Extension: If _meta.agentId provided, look up session from agent record
|
|
133
|
+
// This allows resuming a stopped head manager by MAP agent ID
|
|
134
|
+
// when the TUI doesn't know the ACP session ID
|
|
135
|
+
const metaAgentId = params._meta
|
|
136
|
+
?.agentId;
|
|
137
|
+
if (metaAgentId) {
|
|
138
|
+
const agent = this.eventStore.getAgent(metaAgentId);
|
|
139
|
+
if (!agent) {
|
|
140
|
+
throw new Error(`Agent not found: ${metaAgentId}`);
|
|
141
|
+
}
|
|
142
|
+
acpSessionId = agent.session_id;
|
|
143
|
+
console.log(`[MacroAgent] loadSession: Resolved agentId ${metaAgentId} to session ${acpSessionId}`);
|
|
144
|
+
}
|
|
126
145
|
// Try to find an existing head manager with this session ID
|
|
127
146
|
const headManagers = this.agentManager.listHeadManagers();
|
|
128
147
|
const existing = headManagers.find((hm) => hm.session_id === acpSessionId);
|
|
@@ -203,8 +222,8 @@ export class MacroAgent {
|
|
|
203
222
|
await this.connection.sessionUpdate({
|
|
204
223
|
sessionId: acpSessionId,
|
|
205
224
|
update: {
|
|
206
|
-
|
|
207
|
-
|
|
225
|
+
sessionUpdate: "agent_message_chunk",
|
|
226
|
+
content: { type: "text", text: `Error: ${errorMessage}` },
|
|
208
227
|
},
|
|
209
228
|
});
|
|
210
229
|
return {
|
|
@@ -286,6 +305,8 @@ export class MacroAgent {
|
|
|
286
305
|
return this.handleRespondToPermission(params);
|
|
287
306
|
case "_macro/cancelPermission":
|
|
288
307
|
return this.handleCancelPermission(params);
|
|
308
|
+
case "_macro/resume":
|
|
309
|
+
return this.handleResumeAgent(params);
|
|
289
310
|
default:
|
|
290
311
|
throw new ACPError(`Unknown extension method: ${method}`, "INVALID_EXTENSION");
|
|
291
312
|
}
|
|
@@ -714,6 +735,31 @@ export class MacroAgent {
|
|
|
714
735
|
};
|
|
715
736
|
}
|
|
716
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Resume a stopped/failed agent
|
|
740
|
+
*/
|
|
741
|
+
async handleResumeAgent(params) {
|
|
742
|
+
const { agentId } = params;
|
|
743
|
+
if (!agentId) {
|
|
744
|
+
throw new ACPError("agentId is required", "INVALID_EXTENSION");
|
|
745
|
+
}
|
|
746
|
+
// Verify agent exists
|
|
747
|
+
const agent = this.eventStore.getAgent(agentId);
|
|
748
|
+
if (!agent) {
|
|
749
|
+
throw new ACPError(`Agent not found: ${agentId}`, "AGENT_NOT_FOUND");
|
|
750
|
+
}
|
|
751
|
+
// Only resume stopped/failed agents
|
|
752
|
+
if (agent.state !== "stopped" && agent.state !== "failed") {
|
|
753
|
+
throw new ACPError(`Agent ${agentId} is ${agent.state} — only stopped or failed agents can be resumed`, "INVALID_EXTENSION");
|
|
754
|
+
}
|
|
755
|
+
console.log(`[MacroAgent] Resuming agent ${agentId}`);
|
|
756
|
+
const spawned = await this.agentManager.resume(agentId);
|
|
757
|
+
return {
|
|
758
|
+
success: true,
|
|
759
|
+
agentId: spawned.id,
|
|
760
|
+
sessionId: spawned.session_id,
|
|
761
|
+
};
|
|
762
|
+
}
|
|
717
763
|
// ─────────────────────────────────────────────────────────────────
|
|
718
764
|
// Helper Methods
|
|
719
765
|
// ─────────────────────────────────────────────────────────────────
|