macro-agent 0.2.5 → 0.2.6
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/LICENSE +1 -1
- package/README.md +30 -56
- package/dist/acp/websocket-server.d.ts +6 -0
- package/dist/acp/websocket-server.d.ts.map +1 -1
- package/dist/acp/websocket-server.js +13 -0
- package/dist/acp/websocket-server.js.map +1 -1
- package/dist/acp/websocket-stream.d.ts +30 -0
- package/dist/acp/websocket-stream.d.ts.map +1 -0
- package/dist/acp/websocket-stream.js +118 -0
- package/dist/acp/websocket-stream.js.map +1 -0
- package/dist/activity/deduplication.d.ts +85 -0
- package/dist/activity/deduplication.d.ts.map +1 -0
- package/dist/activity/deduplication.js +149 -0
- package/dist/activity/deduplication.js.map +1 -0
- package/dist/activity/index.d.ts +16 -0
- package/dist/activity/index.d.ts.map +1 -0
- package/dist/activity/index.js +17 -0
- package/dist/activity/index.js.map +1 -0
- package/dist/activity/relevance.d.ts +81 -0
- package/dist/activity/relevance.d.ts.map +1 -0
- package/dist/activity/relevance.js +161 -0
- package/dist/activity/relevance.js.map +1 -0
- package/dist/activity/types.d.ts +169 -0
- package/dist/activity/types.d.ts.map +1 -0
- package/dist/activity/types.js +33 -0
- package/dist/activity/types.js.map +1 -0
- package/dist/activity/watcher.d.ts +64 -0
- package/dist/activity/watcher.d.ts.map +1 -0
- package/dist/activity/watcher.js +212 -0
- package/dist/activity/watcher.js.map +1 -0
- package/dist/adapters/federation.d.ts +8 -1
- package/dist/adapters/federation.d.ts.map +1 -1
- package/dist/adapters/federation.js +33 -2
- package/dist/adapters/federation.js.map +1 -1
- package/dist/agent/agent-manager-v2.d.ts.map +1 -1
- package/dist/agent/agent-manager-v2.js +7 -24
- package/dist/agent/agent-manager-v2.js.map +1 -1
- package/dist/agent/wake.d.ts +85 -0
- package/dist/agent/wake.d.ts.map +1 -0
- package/dist/agent/wake.js +278 -0
- package/dist/agent/wake.js.map +1 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +41 -25
- package/dist/api/server.js.map +1 -1
- package/dist/api/types.d.ts +6 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/auth/server-auth.d.ts +43 -0
- package/dist/auth/server-auth.d.ts.map +1 -0
- package/dist/auth/server-auth.js +80 -0
- package/dist/auth/server-auth.js.map +1 -0
- package/dist/auth/token.d.ts +4 -0
- package/dist/auth/token.d.ts.map +1 -1
- package/dist/auth/token.js +7 -6
- package/dist/auth/token.js.map +1 -1
- package/dist/boot-v2.d.ts +6 -3
- package/dist/boot-v2.d.ts.map +1 -1
- package/dist/boot-v2.js +44 -25
- package/dist/boot-v2.js.map +1 -1
- package/dist/cognitive/team-lifecycle.d.ts +82 -0
- package/dist/cognitive/team-lifecycle.d.ts.map +1 -0
- package/dist/cognitive/team-lifecycle.js +121 -0
- package/dist/cognitive/team-lifecycle.js.map +1 -0
- package/dist/cognitive/trajectory-extractor.d.ts +25 -0
- package/dist/cognitive/trajectory-extractor.d.ts.map +1 -0
- package/dist/cognitive/trajectory-extractor.js +134 -0
- package/dist/cognitive/trajectory-extractor.js.map +1 -0
- package/dist/control/control-server.d.ts.map +1 -1
- package/dist/control/control-server.js +10 -0
- package/dist/control/control-server.js.map +1 -1
- package/dist/dispatch/mail-inbound-consumer.d.ts.map +1 -1
- package/dist/dispatch/mail-inbound-consumer.js +43 -10
- package/dist/dispatch/mail-inbound-consumer.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/lifecycle/handlers/generic.d.ts +27 -0
- package/dist/lifecycle/handlers/generic.d.ts.map +1 -0
- package/dist/lifecycle/handlers/generic.js +56 -0
- package/dist/lifecycle/handlers/generic.js.map +1 -0
- package/dist/lifecycle/handlers/index.d.ts +51 -0
- package/dist/lifecycle/handlers/index.d.ts.map +1 -0
- package/dist/lifecycle/handlers/index.js +110 -0
- package/dist/lifecycle/handlers/index.js.map +1 -0
- package/dist/lifecycle/handlers/integrator.d.ts +81 -0
- package/dist/lifecycle/handlers/integrator.d.ts.map +1 -0
- package/dist/lifecycle/handlers/integrator.js +451 -0
- package/dist/lifecycle/handlers/integrator.js.map +1 -0
- package/dist/lifecycle/handlers/monitor.d.ts +29 -0
- package/dist/lifecycle/handlers/monitor.d.ts.map +1 -0
- package/dist/lifecycle/handlers/monitor.js +79 -0
- package/dist/lifecycle/handlers/monitor.js.map +1 -0
- package/dist/lifecycle/handlers/worker.d.ts +56 -0
- package/dist/lifecycle/handlers/worker.d.ts.map +1 -0
- package/dist/lifecycle/handlers/worker.js +381 -0
- package/dist/lifecycle/handlers/worker.js.map +1 -0
- package/dist/lifecycle/handlers-v2.d.ts +0 -2
- package/dist/lifecycle/handlers-v2.d.ts.map +1 -1
- package/dist/lifecycle/handlers-v2.js +4 -55
- package/dist/lifecycle/handlers-v2.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 +115 -0
- package/dist/map/adapter/acp-over-map.d.ts.map +1 -0
- package/dist/map/adapter/acp-over-map.js +1024 -0
- package/dist/map/adapter/acp-over-map.js.map +1 -0
- package/dist/map/adapter/connection-manager.d.ts +150 -0
- package/dist/map/adapter/connection-manager.d.ts.map +1 -0
- package/dist/map/adapter/connection-manager.js +207 -0
- package/dist/map/adapter/connection-manager.js.map +1 -0
- package/dist/map/adapter/event-log.d.ts +87 -0
- package/dist/map/adapter/event-log.d.ts.map +1 -0
- package/dist/map/adapter/event-log.js +122 -0
- package/dist/map/adapter/event-log.js.map +1 -0
- package/dist/map/adapter/event-translator.d.ts +85 -0
- package/dist/map/adapter/event-translator.d.ts.map +1 -0
- package/dist/map/adapter/event-translator.js +295 -0
- package/dist/map/adapter/event-translator.js.map +1 -0
- 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/agent-lifecycle.d.ts +82 -0
- package/dist/map/adapter/extensions/agent-lifecycle.d.ts.map +1 -0
- package/dist/map/adapter/extensions/agent-lifecycle.js +164 -0
- package/dist/map/adapter/extensions/agent-lifecycle.js.map +1 -0
- package/dist/map/adapter/extensions/cognitive.d.ts +27 -0
- package/dist/map/adapter/extensions/cognitive.d.ts.map +1 -0
- package/dist/map/adapter/extensions/cognitive.js +158 -0
- package/dist/map/adapter/extensions/cognitive.js.map +1 -0
- package/dist/map/adapter/extensions/index.d.ts +95 -0
- package/dist/map/adapter/extensions/index.d.ts.map +1 -0
- package/dist/map/adapter/extensions/index.js +228 -0
- package/dist/map/adapter/extensions/index.js.map +1 -0
- package/dist/map/adapter/extensions/mcp-bridge.d.ts +57 -0
- package/dist/map/adapter/extensions/mcp-bridge.d.ts.map +1 -0
- package/dist/map/adapter/extensions/mcp-bridge.js +745 -0
- package/dist/map/adapter/extensions/mcp-bridge.js.map +1 -0
- 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/streams.d.ts +95 -0
- package/dist/map/adapter/extensions/streams.d.ts.map +1 -0
- package/dist/map/adapter/extensions/streams.js +515 -0
- package/dist/map/adapter/extensions/streams.js.map +1 -0
- package/dist/map/adapter/extensions/task.d.ts +40 -0
- package/dist/map/adapter/extensions/task.d.ts.map +1 -0
- package/dist/map/adapter/extensions/task.js +197 -0
- package/dist/map/adapter/extensions/task.js.map +1 -0
- package/dist/map/adapter/extensions/update-metadata.d.ts +29 -0
- package/dist/map/adapter/extensions/update-metadata.d.ts.map +1 -0
- package/dist/map/adapter/extensions/update-metadata.js +67 -0
- package/dist/map/adapter/extensions/update-metadata.js.map +1 -0
- package/dist/map/adapter/extensions/wake.d.ts +60 -0
- package/dist/map/adapter/extensions/wake.d.ts.map +1 -0
- package/dist/map/adapter/extensions/wake.js +144 -0
- package/dist/map/adapter/extensions/wake.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/extensions/workspace.d.ts +57 -0
- package/dist/map/adapter/extensions/workspace.d.ts.map +1 -0
- package/dist/map/adapter/extensions/workspace.js +81 -0
- package/dist/map/adapter/extensions/workspace.js.map +1 -0
- package/dist/map/adapter/index.d.ts +20 -0
- package/dist/map/adapter/index.d.ts.map +1 -0
- package/dist/map/adapter/index.js +40 -0
- package/dist/map/adapter/index.js.map +1 -0
- package/dist/map/adapter/interface.d.ts +450 -0
- package/dist/map/adapter/interface.d.ts.map +1 -0
- package/dist/map/adapter/interface.js +24 -0
- package/dist/map/adapter/interface.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 +200 -0
- package/dist/map/adapter/map-adapter.d.ts.map +1 -0
- package/dist/map/adapter/map-adapter.js +1199 -0
- package/dist/map/adapter/map-adapter.js.map +1 -0
- package/dist/map/adapter/rpc-handler.d.ts +263 -0
- package/dist/map/adapter/rpc-handler.d.ts.map +1 -0
- package/dist/map/adapter/rpc-handler.js +365 -0
- package/dist/map/adapter/rpc-handler.js.map +1 -0
- package/dist/map/adapter/subscription-manager.d.ts +174 -0
- package/dist/map/adapter/subscription-manager.d.ts.map +1 -0
- package/dist/map/adapter/subscription-manager.js +248 -0
- package/dist/map/adapter/subscription-manager.js.map +1 -0
- package/dist/map/adapter/types.d.ts +194 -0
- package/dist/map/adapter/types.d.ts.map +1 -0
- package/dist/map/adapter/types.js +27 -0
- package/dist/map/adapter/types.js.map +1 -0
- package/dist/map/adapter/websocket-integration.d.ts +113 -0
- package/dist/map/adapter/websocket-integration.d.ts.map +1 -0
- package/dist/map/adapter/websocket-integration.js +134 -0
- package/dist/map/adapter/websocket-integration.js.map +1 -0
- package/dist/map/cascade-action-handler.d.ts.map +1 -1
- package/dist/map/cascade-action-handler.js +19 -5
- package/dist/map/cascade-action-handler.js.map +1 -1
- package/dist/map/federation/envelope.d.ts +98 -0
- package/dist/map/federation/envelope.d.ts.map +1 -0
- package/dist/map/federation/envelope.js +160 -0
- package/dist/map/federation/envelope.js.map +1 -0
- package/dist/map/federation/federation-handler.d.ts +50 -0
- package/dist/map/federation/federation-handler.d.ts.map +1 -0
- package/dist/map/federation/federation-handler.js +306 -0
- package/dist/map/federation/federation-handler.js.map +1 -0
- package/dist/map/federation/index.d.ts +14 -0
- package/dist/map/federation/index.d.ts.map +1 -0
- package/dist/map/federation/index.js +13 -0
- package/dist/map/federation/index.js.map +1 -0
- package/dist/map/federation/types.d.ts +239 -0
- package/dist/map/federation/types.d.ts.map +1 -0
- package/dist/map/federation/types.js +23 -0
- package/dist/map/federation/types.js.map +1 -0
- package/dist/map/server.d.ts.map +1 -1
- package/dist/map/server.js +17 -2
- package/dist/map/server.js.map +1 -1
- package/dist/map/types.d.ts +6 -0
- package/dist/map/types.d.ts.map +1 -1
- package/dist/mcp/map-client.d.ts +39 -0
- package/dist/mcp/map-client.d.ts.map +1 -0
- package/dist/mcp/map-client.js +129 -0
- package/dist/mcp/map-client.js.map +1 -0
- package/dist/mcp/mcp-server.d.ts +72 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -0
- package/dist/mcp/mcp-server.js +1027 -0
- package/dist/mcp/mcp-server.js.map +1 -0
- 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-v2.d.ts +0 -1
- package/dist/mcp/tools/done-v2.d.ts.map +1 -1
- package/dist/mcp/tools/done-v2.js +0 -1
- package/dist/mcp/tools/done-v2.js.map +1 -1
- package/dist/mcp/tools/done.d.ts +102 -0
- package/dist/mcp/tools/done.d.ts.map +1 -0
- package/dist/mcp/tools/done.js +253 -0
- package/dist/mcp/tools/done.js.map +1 -0
- package/dist/mcp/tools/inject_context.d.ts +61 -0
- package/dist/mcp/tools/inject_context.d.ts.map +1 -0
- package/dist/mcp/tools/inject_context.js +123 -0
- package/dist/mcp/tools/inject_context.js.map +1 -0
- 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/mcp/tools/wait_for_activity.d.ts +60 -0
- package/dist/mcp/tools/wait_for_activity.d.ts.map +1 -0
- package/dist/mcp/tools/wait_for_activity.js +135 -0
- package/dist/mcp/tools/wait_for_activity.js.map +1 -0
- package/dist/monitor/health-check-service.d.ts +143 -0
- package/dist/monitor/health-check-service.d.ts.map +1 -0
- package/dist/monitor/health-check-service.js +240 -0
- package/dist/monitor/health-check-service.js.map +1 -0
- package/dist/monitor/index.d.ts +14 -0
- package/dist/monitor/index.d.ts.map +1 -0
- package/dist/monitor/index.js +14 -0
- package/dist/monitor/index.js.map +1 -0
- package/dist/monitor/stall-detector.d.ts +109 -0
- package/dist/monitor/stall-detector.d.ts.map +1 -0
- package/dist/monitor/stall-detector.js +152 -0
- package/dist/monitor/stall-detector.js.map +1 -0
- package/dist/peer/capability-manager.d.ts +56 -0
- package/dist/peer/capability-manager.d.ts.map +1 -0
- package/dist/peer/capability-manager.js +186 -0
- package/dist/peer/capability-manager.js.map +1 -0
- package/dist/peer/encapsulation-manager.d.ts +190 -0
- package/dist/peer/encapsulation-manager.d.ts.map +1 -0
- package/dist/peer/encapsulation-manager.js +486 -0
- package/dist/peer/encapsulation-manager.js.map +1 -0
- package/dist/peer/federation-manager.d.ts +223 -0
- package/dist/peer/federation-manager.d.ts.map +1 -0
- package/dist/peer/federation-manager.js +528 -0
- package/dist/peer/federation-manager.js.map +1 -0
- package/dist/peer/hierarchy-errors.d.ts +208 -0
- package/dist/peer/hierarchy-errors.d.ts.map +1 -0
- package/dist/peer/hierarchy-errors.js +268 -0
- package/dist/peer/hierarchy-errors.js.map +1 -0
- package/dist/peer/hierarchy-protocol.d.ts +159 -0
- package/dist/peer/hierarchy-protocol.d.ts.map +1 -0
- package/dist/peer/hierarchy-protocol.js +142 -0
- package/dist/peer/hierarchy-protocol.js.map +1 -0
- package/dist/peer/index.d.ts +15 -0
- package/dist/peer/index.d.ts.map +1 -0
- package/dist/peer/index.js +15 -0
- package/dist/peer/index.js.map +1 -0
- package/dist/peer/peer-manager.d.ts +99 -0
- package/dist/peer/peer-manager.d.ts.map +1 -0
- package/dist/peer/peer-manager.js +333 -0
- package/dist/peer/peer-manager.js.map +1 -0
- package/dist/peer/task-delegation.d.ts +189 -0
- package/dist/peer/task-delegation.d.ts.map +1 -0
- package/dist/peer/task-delegation.js +303 -0
- package/dist/peer/task-delegation.js.map +1 -0
- package/dist/peer/transports/index.d.ts +8 -0
- package/dist/peer/transports/index.d.ts.map +1 -0
- package/dist/peer/transports/index.js +8 -0
- package/dist/peer/transports/index.js.map +1 -0
- package/dist/peer/transports/local-transport.d.ts +56 -0
- package/dist/peer/transports/local-transport.d.ts.map +1 -0
- package/dist/peer/transports/local-transport.js +263 -0
- package/dist/peer/transports/local-transport.js.map +1 -0
- package/dist/peer/transports/websocket-transport.d.ts +86 -0
- package/dist/peer/transports/websocket-transport.d.ts.map +1 -0
- package/dist/peer/transports/websocket-transport.js +338 -0
- package/dist/peer/transports/websocket-transport.js.map +1 -0
- package/dist/peer/types.d.ts +268 -0
- package/dist/peer/types.d.ts.map +1 -0
- package/dist/peer/types.js +36 -0
- package/dist/peer/types.js.map +1 -0
- package/dist/router/address-resolver.d.ts +102 -0
- package/dist/router/address-resolver.d.ts.map +1 -0
- package/dist/router/address-resolver.js +198 -0
- package/dist/router/address-resolver.js.map +1 -0
- package/dist/router/broadcast.d.ts +53 -0
- package/dist/router/broadcast.d.ts.map +1 -0
- package/dist/router/broadcast.js +75 -0
- package/dist/router/broadcast.js.map +1 -0
- package/dist/router/channels.d.ts +148 -0
- package/dist/router/channels.d.ts.map +1 -0
- package/dist/router/channels.js +126 -0
- package/dist/router/channels.js.map +1 -0
- package/dist/router/index.d.ts +21 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +18 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/message-router.d.ts +197 -0
- package/dist/router/message-router.d.ts.map +1 -0
- package/dist/router/message-router.js +903 -0
- package/dist/router/message-router.js.map +1 -0
- package/dist/router/message-types.d.ts +183 -0
- package/dist/router/message-types.d.ts.map +1 -0
- package/dist/router/message-types.js +79 -0
- package/dist/router/message-types.js.map +1 -0
- package/dist/router/role-resolver.d.ts +67 -0
- package/dist/router/role-resolver.d.ts.map +1 -0
- package/dist/router/role-resolver.js +106 -0
- package/dist/router/role-resolver.js.map +1 -0
- package/dist/router/signals.d.ts +253 -0
- package/dist/router/signals.d.ts.map +1 -0
- package/dist/router/signals.js +53 -0
- package/dist/router/signals.js.map +1 -0
- package/dist/router/types.d.ts +191 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +34 -0
- package/dist/router/types.js.map +1 -0
- package/dist/router/wake.d.ts +111 -0
- package/dist/router/wake.d.ts.map +1 -0
- package/dist/router/wake.js +180 -0
- package/dist/router/wake.js.map +1 -0
- package/dist/server/combined-server.d.ts +95 -0
- package/dist/server/combined-server.d.ts.map +1 -0
- package/dist/server/combined-server.js +335 -0
- package/dist/server/combined-server.js.map +1 -0
- package/dist/steering/index.d.ts +11 -0
- package/dist/steering/index.d.ts.map +1 -0
- package/dist/steering/index.js +11 -0
- package/dist/steering/index.js.map +1 -0
- package/dist/steering/inject.d.ts +39 -0
- package/dist/steering/inject.d.ts.map +1 -0
- package/dist/steering/inject.js +197 -0
- package/dist/steering/inject.js.map +1 -0
- package/dist/steering/types.d.ts +100 -0
- package/dist/steering/types.d.ts.map +1 -0
- package/dist/steering/types.js +11 -0
- package/dist/steering/types.js.map +1 -0
- package/dist/store/backends/index.d.ts +11 -0
- package/dist/store/backends/index.d.ts.map +1 -0
- package/dist/store/backends/index.js +15 -0
- package/dist/store/backends/index.js.map +1 -0
- package/dist/store/backends/json-backend.d.ts +23 -0
- package/dist/store/backends/json-backend.d.ts.map +1 -0
- package/dist/store/backends/json-backend.js +220 -0
- package/dist/store/backends/json-backend.js.map +1 -0
- package/dist/store/backends/memory-backend.d.ts +12 -0
- package/dist/store/backends/memory-backend.d.ts.map +1 -0
- package/dist/store/backends/memory-backend.js +205 -0
- package/dist/store/backends/memory-backend.js.map +1 -0
- package/dist/store/backends/sqlite-backend.d.ts +27 -0
- package/dist/store/backends/sqlite-backend.d.ts.map +1 -0
- package/dist/store/backends/sqlite-backend.js +231 -0
- package/dist/store/backends/sqlite-backend.js.map +1 -0
- package/dist/store/backends/tinybase-backend.d.ts +22 -0
- package/dist/store/backends/tinybase-backend.d.ts.map +1 -0
- package/dist/store/backends/tinybase-backend.js +203 -0
- package/dist/store/backends/tinybase-backend.js.map +1 -0
- package/dist/store/backends/types.d.ts +175 -0
- package/dist/store/backends/types.d.ts.map +1 -0
- package/dist/store/backends/types.js +28 -0
- package/dist/store/backends/types.js.map +1 -0
- package/dist/store/event-store.d.ts +128 -0
- package/dist/store/event-store.d.ts.map +1 -0
- package/dist/store/event-store.js +1751 -0
- package/dist/store/event-store.js.map +1 -0
- package/dist/store/instance.d.ts +290 -0
- package/dist/store/instance.d.ts.map +1 -0
- package/dist/store/instance.js +363 -0
- package/dist/store/instance.js.map +1 -0
- package/dist/store/migrations.d.ts +41 -0
- package/dist/store/migrations.d.ts.map +1 -0
- package/dist/store/migrations.js +79 -0
- package/dist/store/migrations.js.map +1 -0
- package/dist/store/test-utils.d.ts +63 -0
- package/dist/store/test-utils.d.ts.map +1 -0
- package/dist/store/test-utils.js +63 -0
- package/dist/store/test-utils.js.map +1 -0
- package/dist/store/types/config.d.ts +16 -0
- package/dist/store/types/config.d.ts.map +1 -0
- package/dist/store/types/config.js +8 -0
- package/dist/store/types/config.js.map +1 -0
- 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/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.d.ts +115 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +6 -0
- package/dist/store/types.js.map +1 -0
- package/dist/task/backend/index.d.ts +93 -0
- package/dist/task/backend/index.d.ts.map +1 -0
- package/dist/task/backend/index.js +178 -0
- package/dist/task/backend/index.js.map +1 -0
- package/dist/task/backend/memory.d.ts +70 -0
- package/dist/task/backend/memory.d.ts.map +1 -0
- package/dist/task/backend/memory.js +621 -0
- package/dist/task/backend/memory.js.map +1 -0
- package/dist/task/backend/opentasks/backend.d.ts +140 -0
- package/dist/task/backend/opentasks/backend.d.ts.map +1 -0
- package/dist/task/backend/opentasks/backend.js +1023 -0
- package/dist/task/backend/opentasks/backend.js.map +1 -0
- package/dist/task/backend/opentasks/client.d.ts +337 -0
- package/dist/task/backend/opentasks/client.d.ts.map +1 -0
- package/dist/task/backend/opentasks/client.js +225 -0
- package/dist/task/backend/opentasks/client.js.map +1 -0
- package/dist/task/backend/opentasks/daemon-manager.d.ts +89 -0
- package/dist/task/backend/opentasks/daemon-manager.d.ts.map +1 -0
- package/dist/task/backend/opentasks/daemon-manager.js +195 -0
- package/dist/task/backend/opentasks/daemon-manager.js.map +1 -0
- package/dist/task/backend/opentasks/index.d.ts +21 -0
- package/dist/task/backend/opentasks/index.d.ts.map +1 -0
- package/dist/task/backend/opentasks/index.js +21 -0
- package/dist/task/backend/opentasks/index.js.map +1 -0
- package/dist/task/backend/opentasks/mapping.d.ts +48 -0
- package/dist/task/backend/opentasks/mapping.d.ts.map +1 -0
- package/dist/task/backend/opentasks/mapping.js +77 -0
- package/dist/task/backend/opentasks/mapping.js.map +1 -0
- package/dist/task/backend/sudocode/__tests__/integration/test-utils.d.ts +54 -0
- package/dist/task/backend/sudocode/__tests__/integration/test-utils.d.ts.map +1 -0
- package/dist/task/backend/sudocode/__tests__/integration/test-utils.js +88 -0
- package/dist/task/backend/sudocode/__tests__/integration/test-utils.js.map +1 -0
- package/dist/task/backend/sudocode/backend.d.ts +155 -0
- package/dist/task/backend/sudocode/backend.d.ts.map +1 -0
- package/dist/task/backend/sudocode/backend.js +942 -0
- package/dist/task/backend/sudocode/backend.js.map +1 -0
- package/dist/task/backend/sudocode/client.d.ts +303 -0
- package/dist/task/backend/sudocode/client.d.ts.map +1 -0
- package/dist/task/backend/sudocode/client.js +101 -0
- package/dist/task/backend/sudocode/client.js.map +1 -0
- package/dist/task/backend/sudocode/index.d.ts +19 -0
- package/dist/task/backend/sudocode/index.d.ts.map +1 -0
- package/dist/task/backend/sudocode/index.js +17 -0
- package/dist/task/backend/sudocode/index.js.map +1 -0
- package/dist/task/backend/sudocode/mapping.d.ts +51 -0
- package/dist/task/backend/sudocode/mapping.d.ts.map +1 -0
- package/dist/task/backend/sudocode/mapping.js +86 -0
- package/dist/task/backend/sudocode/mapping.js.map +1 -0
- package/dist/task/backend/sudocode/server-client.d.ts +56 -0
- package/dist/task/backend/sudocode/server-client.d.ts.map +1 -0
- package/dist/task/backend/sudocode/server-client.js +367 -0
- package/dist/task/backend/sudocode/server-client.js.map +1 -0
- package/dist/task/backend/sudocode/standalone-client.d.ts +91 -0
- package/dist/task/backend/sudocode/standalone-client.d.ts.map +1 -0
- package/dist/task/backend/sudocode/standalone-client.js +476 -0
- package/dist/task/backend/sudocode/standalone-client.js.map +1 -0
- package/dist/task/backend/sudocode/sync-policy.d.ts +166 -0
- package/dist/task/backend/sudocode/sync-policy.d.ts.map +1 -0
- package/dist/task/backend/sudocode/sync-policy.js +221 -0
- package/dist/task/backend/sudocode/sync-policy.js.map +1 -0
- package/dist/task/backend/sudocode/tools.d.ts +87 -0
- package/dist/task/backend/sudocode/tools.d.ts.map +1 -0
- package/dist/task/backend/sudocode/tools.js +743 -0
- package/dist/task/backend/sudocode/tools.js.map +1 -0
- package/dist/task/backend/tool-provider.d.ts +56 -0
- package/dist/task/backend/tool-provider.d.ts.map +1 -0
- package/dist/task/backend/tool-provider.js +424 -0
- package/dist/task/backend/tool-provider.js.map +1 -0
- package/dist/task/backend/types.d.ts +297 -0
- package/dist/task/backend/types.d.ts.map +1 -0
- package/dist/task/backend/types.js +27 -0
- package/dist/task/backend/types.js.map +1 -0
- package/dist/task/backend/unified-tool-provider.d.ts +57 -0
- package/dist/task/backend/unified-tool-provider.d.ts.map +1 -0
- package/dist/task/backend/unified-tool-provider.js +623 -0
- package/dist/task/backend/unified-tool-provider.js.map +1 -0
- package/dist/task/index.d.ts +7 -0
- package/dist/task/index.d.ts.map +1 -0
- package/dist/task/index.js +7 -0
- package/dist/task/index.js.map +1 -0
- package/dist/task/retry-policy.d.ts +89 -0
- package/dist/task/retry-policy.d.ts.map +1 -0
- package/dist/task/retry-policy.js +160 -0
- package/dist/task/retry-policy.js.map +1 -0
- package/dist/task/task-manager.d.ts +70 -0
- package/dist/task/task-manager.d.ts.map +1 -0
- package/dist/task/task-manager.js +319 -0
- package/dist/task/task-manager.js.map +1 -0
- package/dist/task/types.d.ts +72 -0
- package/dist/task/types.d.ts.map +1 -0
- package/dist/task/types.js +33 -0
- package/dist/task/types.js.map +1 -0
- package/dist/teams/team-loader.d.ts +2 -1
- package/dist/teams/team-loader.d.ts.map +1 -1
- package/dist/teams/team-loader.js +2 -1
- package/dist/teams/team-loader.js.map +1 -1
- package/dist/teams/team-manager.d.ts +101 -0
- package/dist/teams/team-manager.d.ts.map +1 -0
- package/dist/teams/team-manager.js +260 -0
- package/dist/teams/team-manager.js.map +1 -0
- package/dist/teams/team-runtime-v2.d.ts +0 -3
- package/dist/teams/team-runtime-v2.d.ts.map +1 -1
- package/dist/teams/team-runtime-v2.js +8 -87
- package/dist/teams/team-runtime-v2.js.map +1 -1
- package/dist/teams/team-runtime.d.ts +245 -0
- package/dist/teams/team-runtime.d.ts.map +1 -0
- package/dist/teams/team-runtime.js +1023 -0
- package/dist/teams/team-runtime.js.map +1 -0
- package/dist/trigger/router/index.d.ts +11 -0
- package/dist/trigger/router/index.d.ts.map +1 -0
- package/dist/trigger/router/index.js +10 -0
- package/dist/trigger/router/index.js.map +1 -0
- package/dist/trigger/router/strategies/ai-router-strategy.d.ts +34 -0
- package/dist/trigger/router/strategies/ai-router-strategy.d.ts.map +1 -0
- package/dist/trigger/router/strategies/ai-router-strategy.js +359 -0
- package/dist/trigger/router/strategies/ai-router-strategy.js.map +1 -0
- package/dist/trigger/router/strategies/direct-strategy.d.ts +32 -0
- package/dist/trigger/router/strategies/direct-strategy.d.ts.map +1 -0
- package/dist/trigger/router/strategies/direct-strategy.js +119 -0
- package/dist/trigger/router/strategies/direct-strategy.js.map +1 -0
- package/dist/trigger/router/strategies/index.d.ts +11 -0
- package/dist/trigger/router/strategies/index.d.ts.map +1 -0
- package/dist/trigger/router/strategies/index.js +11 -0
- package/dist/trigger/router/strategies/index.js.map +1 -0
- package/dist/trigger/router/strategies/role-strategy.d.ts +39 -0
- package/dist/trigger/router/strategies/role-strategy.d.ts.map +1 -0
- package/dist/trigger/router/strategies/role-strategy.js +207 -0
- package/dist/trigger/router/strategies/role-strategy.js.map +1 -0
- package/dist/trigger/router/trigger-router.d.ts +54 -0
- package/dist/trigger/router/trigger-router.d.ts.map +1 -0
- package/dist/trigger/router/trigger-router.js +362 -0
- package/dist/trigger/router/trigger-router.js.map +1 -0
- package/dist/trigger/router/types.d.ts +225 -0
- package/dist/trigger/router/types.d.ts.map +1 -0
- package/dist/trigger/router/types.js +10 -0
- package/dist/trigger/router/types.js.map +1 -0
- package/dist/trigger/sources/cron/cron-service.d.ts.map +1 -1
- package/dist/trigger/sources/cron/cron-service.js +6 -3
- package/dist/trigger/sources/cron/cron-service.js.map +1 -1
- package/dist/trigger/trigger-system.d.ts +77 -0
- package/dist/trigger/trigger-system.d.ts.map +1 -0
- package/dist/trigger/trigger-system.js +84 -0
- package/dist/trigger/trigger-system.js.map +1 -0
- package/dist/util/git-safety.d.ts +33 -0
- package/dist/util/git-safety.d.ts.map +1 -0
- package/dist/util/git-safety.js +94 -0
- package/dist/util/git-safety.js.map +1 -0
- package/dist/workspace/dataplane-adapter.d.ts +260 -0
- package/dist/workspace/dataplane-adapter.d.ts.map +1 -0
- package/dist/workspace/dataplane-adapter.js +416 -0
- package/dist/workspace/dataplane-adapter.js.map +1 -0
- package/dist/workspace/index.d.ts +0 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +0 -2
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/landing/direct-push.d.ts.map +1 -1
- package/dist/workspace/landing/direct-push.js +22 -7
- package/dist/workspace/landing/direct-push.js.map +1 -1
- package/dist/workspace/landing/queue-to-branch.d.ts.map +1 -1
- package/dist/workspace/landing/queue-to-branch.js +1 -3
- package/dist/workspace/landing/queue-to-branch.js.map +1 -1
- package/dist/workspace/types.d.ts +0 -13
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.d.ts +0 -11
- package/dist/workspace/workspace-manager.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.js +0 -30
- package/dist/workspace/workspace-manager.js.map +1 -1
- package/package.json +28 -2
- package/templates/teams/self-driving/prompts/grinder.md +1 -0
- package/templates/teams/self-driving/prompts/judge.md +1 -0
- package/templates/teams/self-driving/prompts/planner.md +1 -0
- package/templates/teams/self-driving/roles/grinder.yaml +15 -0
- package/templates/teams/self-driving/roles/judge.yaml +10 -0
- package/templates/teams/self-driving/roles/planner.yaml +16 -0
- package/.claude/commands/openspec/apply.md +0 -23
- package/.claude/commands/openspec/archive.md +0 -27
- package/.claude/commands/openspec/proposal.md +0 -28
- package/.claude/settings.json +0 -133
- package/.gitattributes +0 -3
- package/.opentasks/config.json +0 -9
- package/.opentasks/graph.jsonl +0 -0
- package/.sessionlog/settings.json +0 -4
- package/.sudocode/issues.jsonl +0 -183
- package/.sudocode/specs.jsonl +0 -56
- package/AGENTS.md +0 -18
- package/CLAUDE.md +0 -923
- package/docs/architecture.md +0 -508
- package/docs/configuration.md +0 -323
- package/docs/conflict-recovery.md +0 -472
- package/docs/design/task-dispatcher.md +0 -880
- package/docs/design-subsystem-extraction.md +0 -627
- package/docs/git-cascade-integration-gaps.md +0 -678
- package/docs/implementation-details.md +0 -1127
- package/docs/implementation-summary.md +0 -448
- package/docs/lifecycle-events-design.md +0 -111
- package/docs/mail-integration.md +0 -608
- package/docs/openhive-capability-summary.md +0 -415
- package/docs/openhive-integration.md +0 -415
- package/docs/plan-self-driving-support.md +0 -433
- package/docs/roadmap-v2-gaps.md +0 -216
- package/docs/spec-self-driving-support.md +0 -462
- package/docs/team-templates.md +0 -860
- package/docs/teams.md +0 -306
- package/docs/trigger-system-design.md +0 -333
- package/docs/troubleshooting.md +0 -489
- package/docs/workspace-interfaces.md +0 -731
- package/docs/workspace-redesign-plan.md +0 -302
- package/examples/distributed-peer-communication.ts +0 -202
- package/examples/local-peer-communication.ts +0 -165
- package/index.js +0 -2
- package/mvp_docs/agent-execution-system.md +0 -347
- package/mvp_docs/agent-interface.md +0 -580
- package/mvp_docs/data-structures.md +0 -701
- package/mvp_docs/dynamic-meta-orchestration.md +0 -116
- package/mvp_docs/multi-agent-interaction-design.md +0 -779
- package/mvp_docs/mvp-implementation-plan.md +0 -1148
- package/renovate.json5 +0 -6
- package/scripts/test-acp-integration.ts +0 -422
- package/src/__tests__/boot-v2.test.ts +0 -631
- package/src/__tests__/e2e/acp-over-map-live.e2e.test.ts +0 -496
- package/src/__tests__/e2e/acp-over-map.e2e.test.ts +0 -457
- package/src/__tests__/e2e/agent-lifecycle.e2e.test.ts +0 -770
- package/src/__tests__/e2e/auto-sync.e2e.test.ts +0 -257
- package/src/__tests__/e2e/bootstrap.e2e.test.ts +0 -319
- package/src/__tests__/e2e/cascade-rebase.e2e.test.ts +0 -254
- package/src/__tests__/e2e/cc-swarm-bridge.e2e.test.ts +0 -253
- package/src/__tests__/e2e/cli-run.e2e.test.ts +0 -167
- package/src/__tests__/e2e/cognitive-workspace.e2e.test.ts +0 -282
- package/src/__tests__/e2e/dispatch-coordination.e2e.test.ts +0 -495
- package/src/__tests__/e2e/dispatch-live.e2e.test.ts +0 -564
- package/src/__tests__/e2e/dispatch-opentasks.e2e.test.ts +0 -496
- package/src/__tests__/e2e/dispatch-phase2-live.e2e.test.ts +0 -456
- package/src/__tests__/e2e/dispatch-phase2.e2e.test.ts +0 -386
- package/src/__tests__/e2e/dispatch.e2e.test.ts +0 -376
- package/src/__tests__/e2e/done-scenarios.e2e.test.ts +0 -322
- package/src/__tests__/e2e/live-agent.e2e.test.ts +0 -1330
- package/src/__tests__/e2e/map-server.e2e.test.ts +0 -128
- package/src/__tests__/e2e/map-sidecar.e2e.test.ts +0 -139
- package/src/__tests__/e2e/opentasks-integration.e2e.test.ts +0 -280
- package/src/__tests__/e2e/pull-mode.e2e.test.ts +0 -632
- package/src/__tests__/e2e/resume-continue.e2e.test.ts +0 -312
- package/src/__tests__/e2e/self-driving-v3.e2e.test.ts +0 -197
- package/src/__tests__/e2e/spawn-resolver.e2e.test.ts +0 -200
- package/src/__tests__/e2e/swarmkit-integration.e2e.test.ts +0 -562
- package/src/__tests__/e2e/swarmkit-live.e2e.test.ts +0 -1049
- package/src/__tests__/e2e/trajectory-tracking.e2e.test.ts +0 -258
- package/src/__tests__/e2e/trigger-wake.e2e.test.ts +0 -257
- package/src/__tests__/e2e/workspace-lifecycle.e2e.test.ts +0 -383
- package/src/__tests__/e2e/workspace-v3.e2e.test.ts +0 -413
- package/src/acp/__tests__/claude-code-replay.test.ts +0 -225
- package/src/acp/__tests__/macro-agent.test.ts +0 -387
- package/src/acp/__tests__/session-mapper.test.ts +0 -152
- package/src/acp/__tests__/websocket-server.test.ts +0 -194
- package/src/acp/claude-code-replay.ts +0 -208
- package/src/acp/index.ts +0 -32
- package/src/acp/macro-agent.ts +0 -995
- package/src/acp/map-bridge.ts +0 -193
- package/src/acp/session-mapper.ts +0 -116
- package/src/acp/types.ts +0 -99
- package/src/acp/websocket-server.ts +0 -213
- package/src/adapters/__tests__/federation.test.ts +0 -256
- package/src/adapters/__tests__/inbox-adapter.test.ts +0 -316
- package/src/adapters/__tests__/tasks-adapter.test.ts +0 -270
- package/src/adapters/federation.ts +0 -185
- package/src/adapters/inbox-adapter.ts +0 -292
- package/src/adapters/inbox-client-adapter.ts +0 -173
- package/src/adapters/index.ts +0 -44
- package/src/adapters/opentasks-daemon.ts +0 -252
- package/src/adapters/tasks-adapter.ts +0 -330
- package/src/adapters/types.ts +0 -286
- package/src/agent/__tests__/agent-manager-topology.test.ts +0 -73
- package/src/agent/__tests__/agent-manager-v2.completion-signal.test.ts +0 -284
- package/src/agent/__tests__/agent-manager-v2.permission-interception.test.ts +0 -296
- package/src/agent/__tests__/agent-manager-v2.permissions.test.ts +0 -233
- package/src/agent/__tests__/agent-manager-v2.test.ts +0 -614
- package/src/agent/__tests__/agent-store.test.ts +0 -465
- package/src/agent/__tests__/task-ref-resolution.test.ts +0 -231
- package/src/agent/agent-manager-v2.ts +0 -2187
- package/src/agent/agent-manager.ts +0 -403
- package/src/agent/agent-store.ts +0 -409
- package/src/agent/index.ts +0 -7
- package/src/agent/prompts/coordinator-signals.ts +0 -115
- package/src/agent/prompts/index.ts +0 -7
- package/src/agent/system-prompt.ts +0 -298
- package/src/agent/types.ts +0 -480
- package/src/agent-detection/__tests__/command-builder.test.ts +0 -336
- package/src/agent-detection/__tests__/detector.test.ts +0 -768
- package/src/agent-detection/__tests__/registry.test.ts +0 -254
- package/src/agent-detection/command-builder.ts +0 -90
- package/src/agent-detection/detector.ts +0 -307
- package/src/agent-detection/index.ts +0 -36
- package/src/agent-detection/registry.ts +0 -200
- package/src/agent-detection/types.ts +0 -184
- package/src/api/__tests__/server.test.ts +0 -292
- package/src/api/index.ts +0 -8
- package/src/api/server.ts +0 -380
- package/src/api/types.ts +0 -39
- package/src/auth/__tests__/token.test.ts +0 -100
- package/src/auth/index.ts +0 -1
- package/src/auth/token.ts +0 -82
- package/src/boot-v2.ts +0 -1343
- package/src/cli/__tests__/stable-instance-id.test.ts +0 -57
- package/src/cli/acp.ts +0 -101
- package/src/cli/inbox-mcp-proxy.ts +0 -56
- package/src/cli/index.ts +0 -566
- package/src/cli/mcp.ts +0 -305
- package/src/cli/parse-args.ts +0 -54
- package/src/cli/stable-instance-id.ts +0 -14
- package/src/cognitive/__tests__/macro-agent-backend.test.ts +0 -673
- package/src/cognitive/__tests__/session-converter.test.ts +0 -423
- package/src/cognitive/__tests__/workspace-handler.test.ts +0 -221
- package/src/cognitive/analyst-role.ts +0 -59
- package/src/cognitive/index.ts +0 -49
- package/src/cognitive/macro-agent-backend.ts +0 -402
- package/src/cognitive/session-converter.ts +0 -151
- package/src/cognitive/types.ts +0 -187
- package/src/cognitive/workspace-handler.ts +0 -163
- package/src/config/index.ts +0 -9
- package/src/config/project-config.ts +0 -294
- package/src/control/__tests__/control-resilience.test.ts +0 -251
- package/src/control/__tests__/control-socket.test.ts +0 -240
- package/src/control/control-client.ts +0 -337
- package/src/control/control-server.ts +0 -298
- package/src/control/index.ts +0 -17
- package/src/control/types.ts +0 -95
- package/src/dispatch/CLAUDE.md +0 -129
- package/src/dispatch/__tests__/loadout-translation.test.ts +0 -141
- package/src/dispatch/__tests__/mail-inbound-consumer.integration.test.ts +0 -519
- package/src/dispatch/__tests__/mail-inbound-consumer.test.ts +0 -800
- package/src/dispatch/__tests__/mail-inbound-reuse-consumer.test.ts +0 -575
- package/src/dispatch/__tests__/permission-evaluator.test.ts +0 -196
- package/src/dispatch/__tests__/permission-overlay.test.ts +0 -56
- package/src/dispatch/__tests__/permissions-handler.test.ts +0 -168
- package/src/dispatch/__tests__/spawn-agent-handler.test.ts +0 -282
- package/src/dispatch/loadout-translation.ts +0 -138
- package/src/dispatch/mail-inbound-consumer.ts +0 -560
- package/src/dispatch/mail-inbound-reuse-consumer.ts +0 -479
- package/src/dispatch/permission-evaluator.ts +0 -191
- package/src/dispatch/permission-overlay.ts +0 -89
- package/src/dispatch/permissions-handler.ts +0 -112
- package/src/dispatch/spawn-agent-handler.ts +0 -160
- package/src/index.ts +0 -117
- package/src/integrations/__tests__/context-builder.test.ts +0 -218
- package/src/integrations/__tests__/sessionlog.test.ts +0 -498
- package/src/integrations/__tests__/skilltree.test.ts +0 -136
- package/src/integrations/context-builder.ts +0 -280
- package/src/integrations/sessionlog.ts +0 -194
- package/src/integrations/skilltree.ts +0 -184
- package/src/lifecycle/__tests__/cascade-consolidation.test.ts +0 -240
- package/src/lifecycle/__tests__/handlers-v2.test.ts +0 -565
- package/src/lifecycle/cascade.ts +0 -335
- package/src/lifecycle/cleanup.ts +0 -373
- package/src/lifecycle/handlers-v2.ts +0 -508
- package/src/lifecycle/index.ts +0 -76
- package/src/lifecycle/types.ts +0 -260
- package/src/map/__tests__/cascade-bridge.test.ts +0 -229
- package/src/map/__tests__/cascade-diff-server.test.ts +0 -434
- package/src/map/__tests__/emit-event.test.ts +0 -71
- package/src/map/__tests__/lifecycle-bridge.test.ts +0 -430
- package/src/map/__tests__/mail-bridge.test.ts +0 -321
- package/src/map/__tests__/permission-forwarding.test.ts +0 -143
- package/src/map/__tests__/sidecar-diff-install-smoke.test.ts +0 -90
- package/src/map/__tests__/sidecar-integration.test.ts +0 -190
- package/src/map/__tests__/task-bridge.test.ts +0 -153
- package/src/map/__tests__/trajectory-reporter.test.ts +0 -173
- package/src/map/acp-bridge.ts +0 -293
- package/src/map/cascade-action-handler.ts +0 -205
- package/src/map/cascade-bridge.ts +0 -339
- package/src/map/cascade-diff-server.ts +0 -404
- package/src/map/cc-swarm-hooks.ts +0 -242
- package/src/map/coordination-handler.ts +0 -232
- package/src/map/index.ts +0 -18
- package/src/map/lifecycle-bridge.ts +0 -236
- package/src/map/mail-bridge.ts +0 -263
- package/src/map/repo-workspace.ts +0 -82
- package/src/map/server.ts +0 -758
- package/src/map/sidecar.ts +0 -826
- package/src/map/task-bridge.ts +0 -89
- package/src/map/trajectory-reporter.ts +0 -124
- package/src/map/types.ts +0 -304
- package/src/mcp/__tests__/mcp-server-v2.test.ts +0 -236
- package/src/mcp/index.ts +0 -6
- package/src/mcp/mcp-server-v2.ts +0 -485
- package/src/mcp/tools/done-v2.ts +0 -213
- package/src/mcp/types.ts +0 -432
- package/src/metrics/__tests__/metrics.test.ts +0 -205
- package/src/metrics/index.ts +0 -13
- package/src/metrics/metrics.ts +0 -151
- package/src/metrics/types.ts +0 -63
- package/src/roles/__tests__/config-loader.test.ts +0 -540
- package/src/roles/builtin/coordinator.ts +0 -75
- package/src/roles/builtin/generic.ts +0 -39
- package/src/roles/builtin/index.ts +0 -51
- package/src/roles/builtin/integrator.ts +0 -62
- package/src/roles/builtin/monitor.ts +0 -65
- package/src/roles/builtin/worker.ts +0 -134
- package/src/roles/capabilities.ts +0 -257
- package/src/roles/config-loader.ts +0 -405
- package/src/roles/index.ts +0 -141
- package/src/roles/registry.ts +0 -713
- package/src/roles/types.ts +0 -344
- package/src/store/index.ts +0 -8
- package/src/store/types/agents.ts +0 -69
- package/src/store/types/events.ts +0 -91
- package/src/store/types/index.ts +0 -9
- package/src/store/types/messages.ts +0 -32
- package/src/store/types/primitives.ts +0 -9
- package/src/store/types/tasks.ts +0 -124
- package/src/teams/__tests__/team-manager-v2.test.ts +0 -425
- package/src/teams/__tests__/team-runtime-v2.test.ts +0 -402
- package/src/teams/index.ts +0 -29
- package/src/teams/seed-defaults.ts +0 -83
- package/src/teams/team-loader.ts +0 -476
- package/src/teams/team-manager-v2.ts +0 -343
- package/src/teams/team-runtime-v2.ts +0 -943
- package/src/teams/types.ts +0 -276
- package/src/trigger/__tests__/cron-service.test.ts +0 -548
- package/src/trigger/__tests__/scheduler.test.ts +0 -371
- package/src/trigger/__tests__/system-event-queue.test.ts +0 -147
- package/src/trigger/__tests__/trigger-system-v2.test.ts +0 -257
- package/src/trigger/__tests__/wake-manager.test.ts +0 -356
- package/src/trigger/__tests__/webhook-handler.test.ts +0 -567
- package/src/trigger/index.ts +0 -110
- package/src/trigger/queue/index.ts +0 -21
- package/src/trigger/queue/system-event-queue.ts +0 -232
- package/src/trigger/queue/types.ts +0 -149
- package/src/trigger/sources/cron/cron-service.ts +0 -499
- package/src/trigger/sources/cron/index.ts +0 -41
- package/src/trigger/sources/cron/scheduler.ts +0 -344
- package/src/trigger/sources/cron/types.ts +0 -333
- package/src/trigger/sources/index.ts +0 -10
- package/src/trigger/sources/webhook/index.ts +0 -25
- package/src/trigger/sources/webhook/types.ts +0 -205
- package/src/trigger/sources/webhook/webhook-handler.ts +0 -410
- package/src/trigger/strategies/ai-router.ts +0 -170
- package/src/trigger/trigger-system-v2.ts +0 -536
- package/src/trigger/types.ts +0 -228
- package/src/trigger/wake/index.ts +0 -22
- package/src/trigger/wake/types.ts +0 -162
- package/src/trigger/wake/wake-manager.ts +0 -390
- package/src/workspace/__tests__/git-cascade-adapter.test.ts +0 -563
- package/src/workspace/__tests__/land-dispatch.test.ts +0 -214
- package/src/workspace/__tests__/self-driving-yaml.test.ts +0 -122
- package/src/workspace/__tests__/shared-worktree-refcount.test.ts +0 -154
- package/src/workspace/__tests__/standalone-mode.test.ts +0 -118
- package/src/workspace/__tests__/workspace-manager-v3.test.ts +0 -245
- package/src/workspace/__tests__/yaml-schema.test.ts +0 -210
- package/src/workspace/config.ts +0 -165
- package/src/workspace/git-cascade-adapter.ts +0 -1213
- package/src/workspace/index.ts +0 -110
- package/src/workspace/landing/__tests__/strategies.test.ts +0 -184
- package/src/workspace/landing/direct-push.ts +0 -91
- package/src/workspace/landing/index.ts +0 -40
- package/src/workspace/landing/merge-to-parent.ts +0 -229
- package/src/workspace/landing/optimistic-push.ts +0 -36
- package/src/workspace/landing/queue-to-branch.ts +0 -108
- package/src/workspace/merge-queue/__tests__/conflict-resolution-git.e2e.test.ts +0 -641
- package/src/workspace/merge-queue/__tests__/conflict-resolution.test.ts +0 -707
- package/src/workspace/merge-queue/__tests__/merge-queue-concurrent.test.ts +0 -628
- package/src/workspace/merge-queue/__tests__/merge-queue-edge-cases.test.ts +0 -1217
- package/src/workspace/merge-queue/__tests__/merge-queue.test.ts +0 -506
- package/src/workspace/merge-queue/__tests__/real-git-operations.e2e.test.ts +0 -556
- package/src/workspace/merge-queue/__tests__/resolver-flow.test.ts +0 -472
- package/src/workspace/merge-queue/index.ts +0 -38
- package/src/workspace/merge-queue/merge-queue.ts +0 -585
- package/src/workspace/merge-queue/schema.ts +0 -98
- package/src/workspace/merge-queue/types.ts +0 -316
- package/src/workspace/pool/__tests__/worktree-pool.integration.test.ts +0 -1281
- package/src/workspace/pool/__tests__/worktree-pool.test.ts +0 -590
- package/src/workspace/pool/index.ts +0 -26
- package/src/workspace/pool/types.ts +0 -276
- package/src/workspace/pool/worktree-pool.ts +0 -659
- package/src/workspace/recovery/__tests__/auto-resolve-integration.test.ts +0 -127
- package/src/workspace/recovery/__tests__/spawn-resolver.test.ts +0 -139
- package/src/workspace/recovery/__tests__/strategies.test.ts +0 -145
- package/src/workspace/recovery/abandon.ts +0 -51
- package/src/workspace/recovery/auto-resolve.ts +0 -119
- package/src/workspace/recovery/defer.ts +0 -23
- package/src/workspace/recovery/escalate.ts +0 -30
- package/src/workspace/recovery/index.ts +0 -58
- package/src/workspace/recovery/spawn-resolver.ts +0 -152
- package/src/workspace/recovery/types.ts +0 -54
- package/src/workspace/strategies/index.ts +0 -18
- package/src/workspace/strategies/optimistic.ts +0 -139
- package/src/workspace/strategies/queue.ts +0 -81
- package/src/workspace/strategies/registry.ts +0 -89
- package/src/workspace/strategies/trunk.ts +0 -123
- package/src/workspace/strategies/types.ts +0 -145
- package/src/workspace/topology/__tests__/yaml-driven.test.ts +0 -345
- package/src/workspace/topology/index.ts +0 -18
- package/src/workspace/topology/no-workspace.ts +0 -39
- package/src/workspace/topology/types.ts +0 -116
- package/src/workspace/topology/yaml-driven.ts +0 -316
- package/src/workspace/types-v3.ts +0 -162
- package/src/workspace/types.ts +0 -541
- package/src/workspace/workspace-manager.ts +0 -1577
- package/src/workspace/yaml-schema.ts +0 -216
- package/test_fixtures/README.md +0 -425
- package/test_fixtures/fixtures/behaviors/coordinators.ts +0 -196
- package/test_fixtures/fixtures/behaviors/index.ts +0 -62
- package/test_fixtures/fixtures/behaviors/integrators.ts +0 -143
- package/test_fixtures/fixtures/behaviors/monitors.ts +0 -199
- package/test_fixtures/fixtures/behaviors/workers.ts +0 -348
- package/test_fixtures/fixtures/index.ts +0 -7
- package/test_fixtures/fixtures/projects/index.ts +0 -23
- package/test_fixtures/fixtures/projects/project-with-specs.ts +0 -44
- package/test_fixtures/fixtures/projects/typescript-project.ts +0 -200
- package/test_fixtures/fixtures/repos/index.ts +0 -6
- package/test_fixtures/fixtures/repos/temp-repo-factory.ts +0 -299
- package/test_fixtures/fixtures/repos/types.ts +0 -174
- package/test_fixtures/harness/assertions/harness-assertions.ts +0 -752
- package/test_fixtures/harness/assertions/index.ts +0 -8
- package/test_fixtures/harness/index.ts +0 -15
- package/test_fixtures/harness/simulator/agent-simulator.ts +0 -768
- package/test_fixtures/harness/simulator/behavior-executor.ts +0 -580
- package/test_fixtures/harness/simulator/index.ts +0 -14
- package/test_fixtures/harness/simulator/types.ts +0 -459
- package/test_fixtures/harness/test-harness.ts +0 -770
- package/test_fixtures/harness/timing/event-stepper.ts +0 -344
- package/test_fixtures/harness/timing/index.ts +0 -8
- package/tsconfig.json +0 -21
- package/vitest.config.ts +0 -30
- package/vitest.e2e.config.ts +0 -28
- package/vitest.setup.ts +0 -12
package/CLAUDE.md
DELETED
|
@@ -1,923 +0,0 @@
|
|
|
1
|
-
# macro-agent
|
|
2
|
-
|
|
3
|
-
A multi-agent orchestration system for spawning and managing hierarchical AI coding agents. Delegates messaging to **agent-inbox** and task management to **opentasks**. Exposes ACP (WebSocket) and REST API servers, supports cross-instance federation, and can serve as a compute backend for cognitive-core/OpenHive.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
macro-agent enables coordinated work across multiple AI agents with:
|
|
8
|
-
- **Role-based agents** (Worker, Integrator, Coordinator, Monitor, Analyst + custom team roles)
|
|
9
|
-
- **Team templates** for declarative multi-agent topologies (YAML config)
|
|
10
|
-
- **Stream-first workspace layer (V3)** — YAML-driven `TopologyPolicy` compiles role config into per-spawn workspace decisions; falls back to capability-based dispatch for programmatic callers
|
|
11
|
-
- **Pluggable `LandingStrategy`** — `merge-to-parent`, `queue-to-branch`, `direct-push`, `optimistic-push` built-ins; registered on WorkspaceManager, selected per-role via YAML
|
|
12
|
-
- **Pluggable `ConflictRecoveryStrategy`** — `defer`, `abandon`, `escalate`, `auto-resolve` (real git `-X` merge), `spawn-resolver` (LLM resolver agent)
|
|
13
|
-
- **Workspace isolation** via git worktrees + Change-Id tracking (powered by git-cascade 0.0.3+)
|
|
14
|
-
- **Messaging** via agent-inbox (structured inbox/outbox, threading, federation)
|
|
15
|
-
- **Task management** via opentasks (graph-based dependencies, providers, claiming)
|
|
16
|
-
- **Control socket** for MCP subprocess lifecycle RPC (NDJSON over UNIX socket)
|
|
17
|
-
- **Composite signal filtering and emission enforcement** for multi-team communication topology
|
|
18
|
-
- **Trigger system** with pluggable routing strategies (including AI router), wake management, cron, and webhooks
|
|
19
|
-
- **Task dispatch** (opt-in, via `swarm-dispatch` v0.3+) — autonomous orchestrator that polls opentasks for ready work, routes to idle agents via agent-inbox or spawns new ones, tracks lifecycle with continuation/retry split, detects stalls, and reconciles external state changes
|
|
20
|
-
- **Agent detection** for discovering installed CLI coding agents (Claude Code, Codex, etc.)
|
|
21
|
-
- **Health check heartbeats** from MCP subprocesses to the control server
|
|
22
|
-
- **ACP protocol server** with WebSocket transport for external client integration
|
|
23
|
-
- **REST API server** for HTTP-based agent, task, team, and metrics management
|
|
24
|
-
- **Federation** for cross-instance communication between macro-agent instances
|
|
25
|
-
- **Cognitive-core backend** for serving as compute backend for OpenHive
|
|
26
|
-
- **Metrics collection** for point-in-time system observability
|
|
27
|
-
|
|
28
|
-
## Architecture
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
32
|
-
│ External Clients │
|
|
33
|
-
│ (CLI, ACP stdio, WebSocket, REST API) │
|
|
34
|
-
└───────────────────────────┬─────────────────────────────────┘
|
|
35
|
-
│
|
|
36
|
-
┌───────────────────────────▼─────────────────────────────────┐
|
|
37
|
-
│ boot-v2.ts (System Wiring) │
|
|
38
|
-
│ 1. AgentStore (SQLite) 6. TriggerSystemV2 │
|
|
39
|
-
│ 2. InboxAdapter (embedded) 7. ControlServer │
|
|
40
|
-
│ 3. TasksAdapter (IPC) 8. Federation (optional) │
|
|
41
|
-
│ 4. RoleRegistry 9. REST API server (optional) │
|
|
42
|
-
│ 5. AgentManagerV2 10. ACP WebSocket (optional) │
|
|
43
|
-
└───────────────────────────┬─────────────────────────────────┘
|
|
44
|
-
│
|
|
45
|
-
┌───────────────────────────▼─────────────────────────────────┐
|
|
46
|
-
│ TeamManagerV2 (optional, multi-team) │
|
|
47
|
-
│ - Holds multiple TeamRuntimeV2 instances │
|
|
48
|
-
│ - Composite spawn interceptor (delegates per agent-team) │
|
|
49
|
-
│ - Composite signal filters via addSignalFilter(id, fn) │
|
|
50
|
-
│ - Composite emission validators via addEmissionValidator() │
|
|
51
|
-
│ - Agent-to-team mapping (auto-registers children) │
|
|
52
|
-
│ - Each TeamRuntimeV2: │
|
|
53
|
-
│ - Loads team YAML, bootstraps root + companions │
|
|
54
|
-
│ - Scoped inbox (scope = team name) │
|
|
55
|
-
│ - Per-team signal filter + emission validator │
|
|
56
|
-
└───────────────────────────┬─────────────────────────────────┘
|
|
57
|
-
│
|
|
58
|
-
┌───────────────────────────▼─────────────────────────────────┐
|
|
59
|
-
│ AgentManagerV2 │
|
|
60
|
-
│ - Spawns agents via acp-factory (AgentFactory) │
|
|
61
|
-
│ - Manages lifecycle (spawn, prompt, stop, continue, fork) │
|
|
62
|
-
│ - Registers agents in agent-inbox on spawn │
|
|
63
|
-
│ - Workspace allocation via WorkspaceManager │
|
|
64
|
-
│ - Cascade termination with change consolidation │
|
|
65
|
-
│ - Spawn interceptor hook (set by TeamManager) │
|
|
66
|
-
│ - Lifecycle listeners for child-auto-join-team │
|
|
67
|
-
└──────────┬────────────────────────────────────┬─────────────┘
|
|
68
|
-
│ │
|
|
69
|
-
┌──────────▼──────────┐ ┌──────────▼──────────────┐
|
|
70
|
-
│ Control Socket │ │ MCP Server (per agent) │
|
|
71
|
-
│ (UNIX socket) │ │ runs as subprocess │
|
|
72
|
-
│ │ │ │
|
|
73
|
-
│ Main process: │◄─────────── │ cli/mcp.ts connects to: │
|
|
74
|
-
│ ControlServer │ NDJSON RPC │ - ControlClient (spawn, │
|
|
75
|
-
│ - spawn │ │ terminate, hierarchy) │
|
|
76
|
-
│ - terminate │ │ - InboxClientAdapter │
|
|
77
|
-
│ - get_agent │ │ (send, check messages) │
|
|
78
|
-
│ - list_agents │ │ - AgentStore (read-only) │
|
|
79
|
-
│ - get_children │ │ - TasksAdapter (IPC) │
|
|
80
|
-
│ - get_hierarchy │ │ │
|
|
81
|
-
│ - ping │ │ Registers 5-8 tools: │
|
|
82
|
-
│ - health_check │ │ done, spawn_agent, │
|
|
83
|
-
│ │ │ stop_agent, get_hierarchy│
|
|
84
|
-
│ MCP subprocess: │ │ inject_context, │
|
|
85
|
-
│ ControlClient │ │ claim_task, unclaim_task,│
|
|
86
|
-
│ - auto-reconnect │ │ list_claimable_tasks │
|
|
87
|
-
│ - heartbeat ping │ │ │
|
|
88
|
-
└─────────────────────┘ └──────────────────────────┘
|
|
89
|
-
│
|
|
90
|
-
┌──────────┼──────────────────────────────────────┐
|
|
91
|
-
│ │ │
|
|
92
|
-
│ ┌───────▼───────┐ ┌──────────────┐ ┌────────▼───────────┐
|
|
93
|
-
│ │ TriggerSystem │ │ Workspace │ │ Adapters │
|
|
94
|
-
│ │ │ │ Worktrees │ │ │
|
|
95
|
-
│ │ Router with │ │ Strategies │ │ InboxAdapter │
|
|
96
|
-
│ │ pluggable │ │ (queue/ │ │ (embedded inbox │
|
|
97
|
-
│ │ strategies │ │ trunk/opt) │ │ + IPC server) │
|
|
98
|
-
│ │ - direct │ │ MergeQueue │ │ │
|
|
99
|
-
│ │ - role │ │ git-cascade │ │ TasksAdapter │
|
|
100
|
-
│ │ - head │ │ │ │ (opentasks IPC) │
|
|
101
|
-
│ │ - custom │ │ │ │ │
|
|
102
|
-
│ │ │ │ │ │ InboxClientAdapter │
|
|
103
|
-
│ │ WakeManager │ │ │ │ (MCP subprocess │
|
|
104
|
-
│ │ CronService │ │ │ │ IPC client) │
|
|
105
|
-
│ │ WebhookHandler│ │ │ │ │
|
|
106
|
-
│ └───────────────┘ └──────────────┘ └────────┬───────────┘
|
|
107
|
-
│ │
|
|
108
|
-
│ ┌───────────────────┬────────┘
|
|
109
|
-
│ │ │
|
|
110
|
-
│ ┌────────▼─────────┐ ┌──────▼───────────────┐
|
|
111
|
-
│ │ agent-inbox │ │ opentasks │
|
|
112
|
-
│ │ (embedded) │ │ (IPC to daemon) │
|
|
113
|
-
│ │ │ │ │
|
|
114
|
-
│ │ - Messaging │ │ - Task graph │
|
|
115
|
-
│ │ - Threading │ │ - Dependencies │
|
|
116
|
-
│ │ - IPC server │ │ - Providers │
|
|
117
|
-
│ │ - Federation │ │ - Claiming │
|
|
118
|
-
│ └──────────────────┘ └──────────────────────┘
|
|
119
|
-
└─────────────────────────────────────────────────────────┘
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Source Directory Structure
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
src/
|
|
126
|
-
├── acp/ # ACP protocol server
|
|
127
|
-
│ ├── macro-agent.ts # ACP-to-macro-agent bridge (session/new, session/prompt, extensions)
|
|
128
|
-
│ ├── websocket-server.ts # WebSocket server for ACP clients
|
|
129
|
-
│ ├── session-mapper.ts # Maps ACP sessions to agent states
|
|
130
|
-
│ ├── map-bridge.ts # Bridges between MAP and macro-agent protocols
|
|
131
|
-
│ ├── types.ts # Protocol type definitions (MacroAgentInitConfig, ACPError)
|
|
132
|
-
│ └── index.ts # Public exports
|
|
133
|
-
│
|
|
134
|
-
├── adapters/ # Subsystem integration layer
|
|
135
|
-
│ ├── types.ts # InboxAdapter + TasksAdapter interfaces
|
|
136
|
-
│ ├── inbox-adapter.ts # Wraps agent-inbox (embedded, hybrid IPC)
|
|
137
|
-
│ ├── inbox-client-adapter.ts # IPC-only client for MCP subprocesses
|
|
138
|
-
│ ├── tasks-adapter.ts # Wraps opentasks client (IPC to daemon)
|
|
139
|
-
│ ├── opentasks-daemon.ts # Daemon lifecycle helper (start/stop/probe)
|
|
140
|
-
│ ├── federation.ts # Cross-instance communication via federated inboxes
|
|
141
|
-
│ └── index.ts # Public exports
|
|
142
|
-
│
|
|
143
|
-
├── agent/ # Agent lifecycle
|
|
144
|
-
│ ├── agent-manager.ts # AgentManager interface + SpawnInterceptor type
|
|
145
|
-
│ ├── agent-manager-v2.ts # Implementation using adapters + AgentStore
|
|
146
|
-
│ ├── agent-store.ts # Minimal SQLite store (agents + sessions tables)
|
|
147
|
-
│ ├── system-prompt.ts # Agent system prompt generation
|
|
148
|
-
│ ├── types.ts # SpawnAgentOptions, AgentFilter, MCPServerConfig, etc.
|
|
149
|
-
│ ├── prompts/ # Prompt fragments
|
|
150
|
-
│ │ ├── coordinator-signals.ts
|
|
151
|
-
│ │ └── index.ts
|
|
152
|
-
│ └── index.ts # Public exports
|
|
153
|
-
│
|
|
154
|
-
├── agent-detection/ # CLI agent auto-detection
|
|
155
|
-
│ ├── types.ts # CLIAgentDefinition, DetectedAgent, SpawnCommand
|
|
156
|
-
│ ├── detector.ts # Scans PATH for known CLI agents
|
|
157
|
-
│ ├── registry.ts # Registry of known agent definitions
|
|
158
|
-
│ ├── command-builder.ts # Builds headless invocation commands
|
|
159
|
-
│ └── index.ts # Public exports
|
|
160
|
-
│
|
|
161
|
-
├── api/ # REST API server
|
|
162
|
-
│ ├── server.ts # HTTP endpoints for agents, tasks, teams, metrics
|
|
163
|
-
│ ├── types.ts # ApiServer, ApiServerConfig interfaces
|
|
164
|
-
│ └── index.ts # Public exports
|
|
165
|
-
│
|
|
166
|
-
├── auth/ # Authentication
|
|
167
|
-
│ ├── token.ts # AgentTokenManager for per-agent auth tokens
|
|
168
|
-
│ └── index.ts # Public exports
|
|
169
|
-
│
|
|
170
|
-
├── boot-v2.ts # System wiring entry point (single boot function)
|
|
171
|
-
│
|
|
172
|
-
├── cli/ # Command-line interfaces
|
|
173
|
-
│ ├── index.ts # multiagent-cli commands (start, chat, status, etc.)
|
|
174
|
-
│ ├── acp.ts # multiagent ACP stdio mode
|
|
175
|
-
│ ├── mcp.ts # multiagent-mcp subprocess entry point
|
|
176
|
-
│ ├── parse-args.ts # Argument parsing helpers
|
|
177
|
-
│ └── stable-instance-id.ts # Stable instance ID generation
|
|
178
|
-
│
|
|
179
|
-
├── cognitive/ # cognitive-core backend integration
|
|
180
|
-
│ ├── macro-agent-backend.ts # Implements cognitive-core AgentBackend interface
|
|
181
|
-
│ ├── session-converter.ts # Converts sessions between cognitive-core and macro-agent formats
|
|
182
|
-
│ ├── workspace-handler.ts # Workspace operations for cognitive backend
|
|
183
|
-
│ ├── analyst-role.ts # Analyst role definition for cognitive system
|
|
184
|
-
│ ├── types.ts # CognitiveAgentSession, CognitiveBatchConfig, etc.
|
|
185
|
-
│ └── index.ts # Public exports
|
|
186
|
-
│
|
|
187
|
-
├── config/ # Project configuration
|
|
188
|
-
│ ├── project-config.ts # .multiagent/config.json loader
|
|
189
|
-
│ └── index.ts # Public exports
|
|
190
|
-
│
|
|
191
|
-
├── control/ # Control socket (MCP subprocess ↔ main process)
|
|
192
|
-
│ ├── control-server.ts # NDJSON server, dispatches to AgentManager
|
|
193
|
-
│ ├── control-client.ts # NDJSON client with auto-reconnect
|
|
194
|
-
│ ├── types.ts # ControlCommand, ControlResponse types
|
|
195
|
-
│ └── index.ts # Public exports
|
|
196
|
-
│
|
|
197
|
-
├── index.ts # Public library exports
|
|
198
|
-
│
|
|
199
|
-
├── lifecycle/ # Agent lifecycle management
|
|
200
|
-
│ ├── handlers-v2.ts # Role-specific done() handlers (using adapters)
|
|
201
|
-
│ ├── cascade.ts # Cascade termination with change consolidation
|
|
202
|
-
│ ├── cleanup.ts # Workspace cleanup helpers (commitChanges)
|
|
203
|
-
│ ├── types.ts # DoneArgs, DoneResult, LifecycleContext, CascadeOptions
|
|
204
|
-
│ └── index.ts # Public exports
|
|
205
|
-
│
|
|
206
|
-
├── mcp/ # Model Context Protocol (per-agent tools)
|
|
207
|
-
│ ├── mcp-server-v2.ts # Factory: registers 5 core + 3 claim tools
|
|
208
|
-
│ ├── tools/
|
|
209
|
-
│ │ └── done-v2.ts # done() tool using adapters
|
|
210
|
-
│ ├── types.ts # ToolContext, HierarchyNode, MCPToolError
|
|
211
|
-
│ └── index.ts # Public exports
|
|
212
|
-
│
|
|
213
|
-
├── metrics/ # Metrics collection and reporting
|
|
214
|
-
│ ├── metrics.ts # collectMetrics() — point-in-time agent/task/system snapshot
|
|
215
|
-
│ ├── types.ts # AgentMetrics, TaskMetrics, SystemMetrics, MetricsSnapshot
|
|
216
|
-
│ └── index.ts # Public exports
|
|
217
|
-
│
|
|
218
|
-
├── roles/ # Role system
|
|
219
|
-
│ ├── types.ts # RoleDefinition, RoleRegistry, Capability types
|
|
220
|
-
│ ├── capabilities.ts # Capability constants (AGENT_CAPABILITIES, WORKSPACE_CAPABILITIES)
|
|
221
|
-
│ ├── registry.ts # DefaultRoleRegistry with resolution + tool filtering
|
|
222
|
-
│ ├── config-loader.ts # Load role definitions from YAML files
|
|
223
|
-
│ ├── builtin/ # Built-in role definitions
|
|
224
|
-
│ │ ├── worker.ts
|
|
225
|
-
│ │ ├── integrator.ts
|
|
226
|
-
│ │ ├── coordinator.ts
|
|
227
|
-
│ │ ├── monitor.ts
|
|
228
|
-
│ │ ├── generic.ts
|
|
229
|
-
│ │ └── index.ts
|
|
230
|
-
│ └── index.ts # Public exports
|
|
231
|
-
│
|
|
232
|
-
├── store/ # Shared type definitions (no runtime implementation)
|
|
233
|
-
│ ├── types/
|
|
234
|
-
│ │ ├── agents.ts # Agent, AgentState, StopReason
|
|
235
|
-
│ │ ├── tasks.ts # Task, TaskStatus
|
|
236
|
-
│ │ ├── events.ts # Event, EventType, EventSource
|
|
237
|
-
│ │ ├── messages.ts # QueuedMessage, Subscription types
|
|
238
|
-
│ │ ├── primitives.ts # AgentId, TaskId, EventId, SessionId, Timestamp
|
|
239
|
-
│ │ └── index.ts # Re-exports all types
|
|
240
|
-
│ └── index.ts # Public exports
|
|
241
|
-
│
|
|
242
|
-
├── teams/ # Team template system
|
|
243
|
-
│ ├── types.ts # TeamManifest, TeamTopology, TeamCommunication
|
|
244
|
-
│ ├── team-loader.ts # YAML loading, role resolution, validation
|
|
245
|
-
│ ├── team-runtime-v2.ts # Per-team runtime (scoped inbox, signal filtering)
|
|
246
|
-
│ ├── team-manager-v2.ts # Multi-team orchestrator (composite filters)
|
|
247
|
-
│ ├── seed-defaults.ts # Seed default team templates
|
|
248
|
-
│ └── index.ts # Public exports
|
|
249
|
-
│
|
|
250
|
-
├── trigger/ # Trigger system
|
|
251
|
-
│ ├── trigger-system-v2.ts # Factory + TriggerRouterV2 with routing strategies
|
|
252
|
-
│ ├── types.ts # TriggerEvent, TriggerSource, RoutingHint types
|
|
253
|
-
│ ├── queue/ # Per-agent system event queue
|
|
254
|
-
│ │ ├── system-event-queue.ts
|
|
255
|
-
│ │ ├── types.ts
|
|
256
|
-
│ │ └── index.ts
|
|
257
|
-
│ ├── wake/ # Wake manager
|
|
258
|
-
│ │ ├── wake-manager.ts # Heartbeat + coalesce + inject→interrupt→prompt
|
|
259
|
-
│ │ ├── types.ts
|
|
260
|
-
│ │ └── index.ts
|
|
261
|
-
│ ├── strategies/ # Pluggable routing strategies
|
|
262
|
-
│ │ └── ai-router.ts # AI-powered routing via temporary Claude session
|
|
263
|
-
│ ├── sources/ # Trigger event sources
|
|
264
|
-
│ │ ├── cron/
|
|
265
|
-
│ │ │ ├── cron-service.ts
|
|
266
|
-
│ │ │ ├── scheduler.ts
|
|
267
|
-
│ │ │ ├── types.ts
|
|
268
|
-
│ │ │ └── index.ts
|
|
269
|
-
│ │ ├── webhook/
|
|
270
|
-
│ │ │ ├── webhook-handler.ts
|
|
271
|
-
│ │ │ ├── types.ts
|
|
272
|
-
│ │ │ └── index.ts
|
|
273
|
-
│ │ └── index.ts
|
|
274
|
-
│ └── index.ts # Public exports
|
|
275
|
-
│
|
|
276
|
-
└── workspace/ # Workspace isolation — V3 stream-first + legacy role-shaped
|
|
277
|
-
├── workspace-manager.ts # WorkspaceManager implementation (legacy + V3 surfaces)
|
|
278
|
-
├── git-cascade-adapter.ts # Wraps git-cascade tracker (40+ primitives surfaced)
|
|
279
|
-
├── config.ts # GitCascadeConfig + pool config
|
|
280
|
-
├── types.ts # WorkspaceManager interface (legacy + V3), events
|
|
281
|
-
├── types-v3.ts # V3 types: Principal, StreamSpec, LandingStrategy, etc.
|
|
282
|
-
├── yaml-schema.ts # Zod schema for `macro_agent.workspace`
|
|
283
|
-
├── topology/ # TopologyPolicy — compiles YAML → spawn decisions
|
|
284
|
-
│ ├── types.ts # TopologyPolicy, WorkspaceDecision, contexts
|
|
285
|
-
│ ├── yaml-driven.ts # YamlDrivenTopology (primary)
|
|
286
|
-
│ ├── no-workspace.ts # NoWorkspaceTopology (null policy)
|
|
287
|
-
│ └── index.ts
|
|
288
|
-
├── landing/ # LandingStrategy — pluggable merge/push algorithms
|
|
289
|
-
│ ├── merge-to-parent.ts # mergeStream into parent + optional cascadeRebase
|
|
290
|
-
│ ├── queue-to-branch.ts # git-cascade built-in merge queue
|
|
291
|
-
│ ├── direct-push.ts # rebase + push
|
|
292
|
-
│ ├── optimistic-push.ts # direct-push + validation event
|
|
293
|
-
│ └── index.ts # registerBuiltinLandingStrategies()
|
|
294
|
-
├── recovery/ # ConflictRecoveryStrategy
|
|
295
|
-
│ ├── types.ts # ConflictContext, ConflictResolution
|
|
296
|
-
│ ├── defer.ts # Leave conflict record; no-op
|
|
297
|
-
│ ├── abandon.ts # Abandon the conflicted stream
|
|
298
|
-
│ ├── escalate.ts # Pause + notify human
|
|
299
|
-
│ ├── auto-resolve.ts # Replay merge with -X ours|theirs|union
|
|
300
|
-
│ ├── spawn-resolver.ts # Spawn a resolver agent (requires AgentManager)
|
|
301
|
-
│ └── index.ts # buildBuiltinRecoveryRegistry()
|
|
302
|
-
├── pool/ # Worktree pool management
|
|
303
|
-
│ ├── worktree-pool.ts
|
|
304
|
-
│ ├── types.ts
|
|
305
|
-
│ └── index.ts
|
|
306
|
-
├── merge-queue/ # @deprecated — legacy SQLite-backed queue,
|
|
307
|
-
│ ├── merge-queue.ts # duplicates git-cascade's built-in. Use
|
|
308
|
-
│ ├── schema.ts # GitCascadeAdapter.addToMergeQueue for
|
|
309
|
-
│ ├── types.ts # new code (via QueueToBranchStrategy).
|
|
310
|
-
│ └── index.ts
|
|
311
|
-
├── strategies/ # @deprecated — old IntegrationStrategy.
|
|
312
|
-
│ ├── types.ts # Superseded by workspace/landing/.
|
|
313
|
-
│ ├── queue.ts # Scheduled for removal once all teams
|
|
314
|
-
│ ├── trunk.ts # migrate to macro_agent.workspace YAML.
|
|
315
|
-
│ ├── optimistic.ts
|
|
316
|
-
│ └── index.ts
|
|
317
|
-
└── index.ts # Public exports
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
## Key Concepts
|
|
321
|
-
|
|
322
|
-
### Subsystem Architecture
|
|
323
|
-
|
|
324
|
-
macro-agent delegates two major concerns to external subsystems:
|
|
325
|
-
|
|
326
|
-
- **agent-inbox**: All messaging (send/receive, threading, conversations, federation). Embedded in-process for zero-latency events, with IPC server for agent MCP subprocesses.
|
|
327
|
-
- **opentasks**: Task management for pull-mode workflows (claiming, dependencies, state transitions). Connected via IPC to opentasks daemon (auto-started if needed). Note: AgentManagerV2 does **not** create opentasks nodes on spawn or transition them on terminate — that was removed to avoid polluting the task graph with per-session noise. Opentasks is used only for explicit task operations (pull-mode claim/unclaim/list, team task coordination).
|
|
328
|
-
|
|
329
|
-
macro-agent owns: agent lifecycle, workspace isolation, team topology, role system, trigger/wake, control socket.
|
|
330
|
-
|
|
331
|
-
### Adapter Layer
|
|
332
|
-
|
|
333
|
-
Three adapters form the integration boundary:
|
|
334
|
-
|
|
335
|
-
| Adapter | Module | Used By | Purpose |
|
|
336
|
-
|---------|--------|---------|---------|
|
|
337
|
-
| **InboxAdapter** | `adapters/inbox-adapter.ts` | Main process | Embeds agent-inbox, owns composite signal filters + emission validators |
|
|
338
|
-
| **InboxClientAdapter** | `adapters/inbox-client-adapter.ts` | MCP subprocesses | IPC client to main process's agent-inbox |
|
|
339
|
-
| **TasksAdapter** | `adapters/tasks-adapter.ts` | Both | IPC client to opentasks daemon |
|
|
340
|
-
|
|
341
|
-
InboxAdapter key details:
|
|
342
|
-
- `send()`: Runs emission validators (all must pass) before forwarding to agent-inbox
|
|
343
|
-
- `onDelivery()`: Runs signal filters (AND logic — all must return true) before invoking handlers
|
|
344
|
-
- Multi-team support: `addSignalFilter(id, fn)` / `addEmissionValidator(id, fn)` for named composite hooks
|
|
345
|
-
- Single-team compat: `setSignalFilter(fn)` installs under the "default" key
|
|
346
|
-
|
|
347
|
-
### Control Socket
|
|
348
|
-
|
|
349
|
-
NDJSON-over-UNIX-socket RPC between MCP subprocesses and the main process. Separates the **control plane** (lifecycle operations) from the **data plane** (messaging via agent-inbox IPC).
|
|
350
|
-
|
|
351
|
-
| Component | Module | Process |
|
|
352
|
-
|-----------|--------|---------|
|
|
353
|
-
| **ControlServer** | `control/control-server.ts` | Main process |
|
|
354
|
-
| **ControlClient** | `control/control-client.ts` | MCP subprocess |
|
|
355
|
-
|
|
356
|
-
Commands: `spawn`, `terminate`, `get_agent`, `list_agents`, `get_children`, `get_hierarchy`, `ping`, `health_check`
|
|
357
|
-
|
|
358
|
-
Health check heartbeats:
|
|
359
|
-
- MCP subprocesses send periodic `health_check` commands with `agentId` and `mcpPid`
|
|
360
|
-
- ControlServer tracks `lastSeen` timestamps per agent
|
|
361
|
-
- Enables detection of stale/crashed MCP subprocesses
|
|
362
|
-
|
|
363
|
-
ControlClient features:
|
|
364
|
-
- Auto-reconnect with exponential backoff on socket close
|
|
365
|
-
- Configurable timeout (default 30s)
|
|
366
|
-
- Sequence-numbered request/response correlation
|
|
367
|
-
|
|
368
|
-
### AgentStore
|
|
369
|
-
|
|
370
|
-
Minimal SQLite store (`~/.macro-agent/agents.db`) with two tables: `agents` and `sessions`. Replaces the heavy EventStore + TinyBase materialized views. Simple CRUD, no event sourcing. Accessed read-only by MCP subprocesses via SQLite WAL mode.
|
|
371
|
-
|
|
372
|
-
### Teams
|
|
373
|
-
|
|
374
|
-
Teams are declarative YAML configurations that define multi-agent topologies.
|
|
375
|
-
|
|
376
|
-
- **TeamLoader** (`team-loader.ts`): Parses `team.yaml`, resolves role inheritance, validates topology
|
|
377
|
-
- **TeamRuntimeV2** (`team-runtime-v2.ts`): Per-team runtime — registers roles, bootstraps root + companions, installs scoped signal filter + emission validator on InboxAdapter via named keys
|
|
378
|
-
- **TeamManagerV2** (`team-manager-v2.ts`): Multi-team orchestrator — holds all TeamRuntimeV2 instances, installs a composite spawn interceptor on AgentManager, maintains agent-to-team mapping, auto-registers children in parent's team via lifecycle listener
|
|
379
|
-
- **Scope**: Each team gets its own agent-inbox scope (scope = team name)
|
|
380
|
-
- **Composite filters**: Multiple teams install named signal filters and emission validators on the same InboxAdapter. The adapter evaluates all filters with AND logic (all must pass) and all validators (first rejection wins).
|
|
381
|
-
|
|
382
|
-
### Roles
|
|
383
|
-
|
|
384
|
-
Agents are assigned roles that determine their capabilities:
|
|
385
|
-
|
|
386
|
-
| Role | Purpose | Key Capabilities |
|
|
387
|
-
|------|---------|------------------|
|
|
388
|
-
| **Worker** | Execute tasks in isolated workspace | File I/O, git operations, task completion |
|
|
389
|
-
| **Integrator** | Manage merge queue and resolve conflicts | Merge operations, branch management |
|
|
390
|
-
| **Coordinator** | Orchestrate workers and manage tasks | Spawn agents, assign tasks, broadcast |
|
|
391
|
-
| **Monitor** | Health monitoring and alerts | Read-only access, activity watching |
|
|
392
|
-
| **Generic** | Base role for custom extensions | Minimal capabilities |
|
|
393
|
-
|
|
394
|
-
Teams can define custom roles (e.g., planner, grinder, judge) that extend built-in roles via `extends` in `roles/<name>.yaml`. Tool filtering is role-based — `isToolAllowedForRole()` checks the role's capabilities before registering each MCP tool.
|
|
395
|
-
|
|
396
|
-
### Workspace Layer (V3 Stream-First)
|
|
397
|
-
|
|
398
|
-
The workspace layer went through a v3 redesign. Two paths coexist:
|
|
399
|
-
|
|
400
|
-
**V3 path (YAML-driven, recommended for teams):**
|
|
401
|
-
- `macro_agent.workspace` block in `team.yaml` declares per-role workspace decisions
|
|
402
|
-
- `TopologyPolicy` (`workspace/topology/`) compiles YAML → `WorkspaceDecision` per spawn
|
|
403
|
-
- `LandingStrategy` (`workspace/landing/`) finalizes work at `done()` time
|
|
404
|
-
- `ConflictRecoveryStrategy` (`workspace/recovery/`) dispatches on conflicts
|
|
405
|
-
- Auto-wired by `TeamManagerV2.startTeam()` when workspace config is present
|
|
406
|
-
|
|
407
|
-
**Legacy path (programmatic / capability-based):**
|
|
408
|
-
- Direct `agentManager.spawn({ capabilities: ['workspace.worktree'|'workspace.stream'|'workspace.integrate'], streamId, streamConfig })`
|
|
409
|
-
- `capabilityBasedDispatch` in `AgentManagerV2` routes to role-shaped `WorkspaceManager` methods (`createWorkerWorkspace`, etc.)
|
|
410
|
-
- Retained for programmatic callers (tools, libraries, tests that don't load team YAML)
|
|
411
|
-
|
|
412
|
-
**Dispatch priority in `AgentManagerV2.createWorkspaceForRole()`:**
|
|
413
|
-
1. If `topologyPolicy` is set → V3 path via `executeWorkspaceDecision`
|
|
414
|
-
2. Else → `capabilityBasedDispatch` using role-shaped methods
|
|
415
|
-
|
|
416
|
-
### TopologyPolicy (V3)
|
|
417
|
-
|
|
418
|
-
`TopologyPolicy` (`workspace/topology/types.ts`) is the contract for compiling
|
|
419
|
-
team YAML into per-spawn workspace decisions. Three built-ins:
|
|
420
|
-
|
|
421
|
-
| Policy | Module | Purpose |
|
|
422
|
-
|---|---|---|
|
|
423
|
-
| **YamlDrivenTopology** | `topology/yaml-driven.ts` | Primary; reads `macro_agent.workspace` |
|
|
424
|
-
| **NoWorkspaceTopology** | `topology/no-workspace.ts` | Null policy; returns `share-parent-cwd` for all |
|
|
425
|
-
|
|
426
|
-
Hook methods:
|
|
427
|
-
- `onTeamStart(ctx)` → creates team-root stream if any role needs it
|
|
428
|
-
- `onAgentSpawn(ctx)` → returns `WorkspaceDecision` (`none` / `share-parent-cwd` / `share-with-agent` / `attach-to-stream` / `new-stream`)
|
|
429
|
-
- `onAgentComplete(ctx)` → deallocates the agent's worktree
|
|
430
|
-
- `onTeamStop(ctx)` → applies `on_team_complete` action (`keep` / `merge_to_main` / `abandon`)
|
|
431
|
-
|
|
432
|
-
The YAML schema (`workspace/yaml-schema.ts`) supports:
|
|
433
|
-
- `workspace`: `none` / `attach_to_team_root` / `share_with_agent` / `share_parent_cwd` / `new_stream`
|
|
434
|
-
- `stream_lineage`: `from_team_root` / `fork_from_team_root` / `fork_from_parent` / `independent` / `track_existing_branch`
|
|
435
|
-
- `allocation`, `landing`, `landing_config`, `on_conflict`, `on_conflict_recovery`, `conflict_recovery_config`, `cascade_on_parent_update`, `on_parent_advanced`, `share_with`, `track_branch`, `capabilities`
|
|
436
|
-
|
|
437
|
-
### LandingStrategies (V3)
|
|
438
|
-
|
|
439
|
-
`LandingStrategy` (`workspace/types-v3.ts`) is how a streamed agent finalizes
|
|
440
|
-
its work. Registered on `WorkspaceManager` via `registerLandingStrategy(s)`
|
|
441
|
-
and selected per-role via YAML `landing:`. Four built-ins registered by
|
|
442
|
-
`registerBuiltinLandingStrategies()`:
|
|
443
|
-
|
|
444
|
-
| Strategy | Module | Semantics |
|
|
445
|
-
|---|---|---|
|
|
446
|
-
| **merge-to-parent** | `landing/merge-to-parent.ts` | `mergeStream(source → parent)`, optional `cascadeRebase` via `strategyConfig.cascade: true` |
|
|
447
|
-
| **queue-to-branch** | `landing/queue-to-branch.ts` | `GitCascadeAdapter.addToMergeQueue(streamId, targetBranch)` — drained by integrator-capable agents |
|
|
448
|
-
| **direct-push** | `landing/direct-push.ts` | Rebase + `git push` with retries (trunk flow) |
|
|
449
|
-
| **optimistic-push** | `landing/optimistic-push.ts` | `direct-push` + emits validation event |
|
|
450
|
-
|
|
451
|
-
`LandingContext` carries: `agentId`, `streamId`, `sourceWorktree`,
|
|
452
|
-
`targetStreamId`, `strategyConfig` (from YAML `landing_config`), and a back-
|
|
453
|
-
reference to `WorkspaceManager`.
|
|
454
|
-
|
|
455
|
-
### Conflict Recovery (V3)
|
|
456
|
-
|
|
457
|
-
When a landing returns a conflict, the agent's `done()` flow dispatches to a
|
|
458
|
-
`ConflictRecoveryStrategy` (`workspace/recovery/types.ts`) selected via YAML
|
|
459
|
-
`on_conflict_recovery:` or team default. Five built-ins:
|
|
460
|
-
|
|
461
|
-
| Strategy | Mode | Behavior |
|
|
462
|
-
|---|---|---|
|
|
463
|
-
| **defer** | sync | No-op — leaves conflict record for later manual recovery |
|
|
464
|
-
| **abandon** | sync | `abandonStream(streamId)` — throwaway work |
|
|
465
|
-
| **escalate** | async | `pauseStream` + emit escalation — awaits external `resolve_conflict` MCP call |
|
|
466
|
-
| **auto-resolve** | sync | Replays merge with `-X ours|theirs|union` in the agent's worktree, commits, notifies `workspaceManager.resolveConflict` |
|
|
467
|
-
| **spawn-resolver** | async | Spawns a resolver agent on the conflicted stream; awaits `conflict:resolved` event or timeout |
|
|
468
|
-
|
|
469
|
-
`spawn-resolver` requires `AgentManager` injection (not in default registry;
|
|
470
|
-
register via `createSpawnResolverStrategy({ agentManager })`). Max concurrent
|
|
471
|
-
resolvers per stream is configurable; timeout falls back to `escalated`.
|
|
472
|
-
|
|
473
|
-
`ConflictContext` carries: `conflictId`, `streamId`, `paths`, `operation`
|
|
474
|
-
(`merge` | `sync` | `rebase` | `cascade`), `worktree?` (required for
|
|
475
|
-
`auto-resolve`), `landingAgentId?`, `recoveryDepth`, `strategyConfig`.
|
|
476
|
-
|
|
477
|
-
### Workspace Isolation (shared across paths)
|
|
478
|
-
|
|
479
|
-
Each streamed agent gets an isolated git worktree via `WorkspaceManager`,
|
|
480
|
-
backed by git-cascade's `MultiAgentRepoTracker`. V3 agents use
|
|
481
|
-
`allocateWorktree({ agentId, streamId })`; legacy agents use role-specific
|
|
482
|
-
`createWorkerWorkspace` / `createIntegratorWorkspace` / `createCoordinatorWorkspace`.
|
|
483
|
-
Both produce the same underlying git worktree structure.
|
|
484
|
-
|
|
485
|
-
Change-Id tracking via `commitChanges({ agentId, streamId, worktree, message })`
|
|
486
|
-
(v3) — each commit gets a stable `Change-Id: c-xxxxxxxx` trailer that survives
|
|
487
|
-
rebases. Legacy callers that use raw `git commit` bypass this tracking.
|
|
488
|
-
|
|
489
|
-
### MCP Tool Surface
|
|
490
|
-
|
|
491
|
-
Each agent gets tools from three sources:
|
|
492
|
-
|
|
493
|
-
| Source | Tools | Mount method |
|
|
494
|
-
|--------|-------|-------------|
|
|
495
|
-
| **macro-agent** (MCPServerV2) | `done`, `spawn_agent`, `stop_agent`, `get_hierarchy`, `inject_context` | Built-in MCP server (stdio) |
|
|
496
|
-
| **macro-agent** (MCPServerV2, pull mode) | `claim_task`, `unclaim_task`, `list_claimable_tasks` | Built-in MCP server (gated by `task.claim` capability) |
|
|
497
|
-
| **agent-inbox** | `send_message`, `check_inbox`, `read_thread`, `list_agents` | IPC socket (separate MCP server) |
|
|
498
|
-
| **opentasks** | `task`, `link`, `annotate`, `query` | IPC socket (separate MCP server) |
|
|
499
|
-
|
|
500
|
-
Tool registration in MCPServerV2 is role-gated: `shouldRegister(toolName)` checks `isToolAllowedForRole()` before calling `server.registerTool()`.
|
|
501
|
-
|
|
502
|
-
### Trigger System
|
|
503
|
-
|
|
504
|
-
Routes external events and inbox delivery events to agents via pluggable routing strategies.
|
|
505
|
-
|
|
506
|
-
**Components:**
|
|
507
|
-
- **TriggerRouterV2**: Pluggable strategy-based router
|
|
508
|
-
- **WakeManager**: Heartbeat + coalesce + inject/interrupt/prompt fallback chain
|
|
509
|
-
- **SystemEventQueue**: Per-agent event queue with priority and deduplication
|
|
510
|
-
- **CronService**: Time-based agent activation via cron schedules
|
|
511
|
-
- **WebhookHandler**: HTTP endpoint triggers
|
|
512
|
-
|
|
513
|
-
**Routing Strategies** (pluggable via `RoutingStrategy` interface):
|
|
514
|
-
|
|
515
|
-
| Strategy | Description | Selection |
|
|
516
|
-
|----------|-------------|-----------|
|
|
517
|
-
| **direct** | Route to a specific agent by ID | `routing.target.type === "agent"` |
|
|
518
|
-
| **role** | Route to all agents with a given role | `routing.target.type === "role"` |
|
|
519
|
-
| **head** | Route to all running root agents (default) | Fallback when no strategy matches |
|
|
520
|
-
| **custom** | User-defined strategies via `registerStrategy()` | By name or `canHandle()` |
|
|
521
|
-
|
|
522
|
-
Strategy resolution order: explicit `strategyName` > first `canHandle()` match > default strategy.
|
|
523
|
-
|
|
524
|
-
**Inbox-to-Wake integration:**
|
|
525
|
-
- `InboxAdapter.onDelivery` fires on every message delivery
|
|
526
|
-
- Importance is mapped to wake action: `urgent` → interrupt/wake, `high` → inject/wake, `normal` → queue/wake, `low` → queue
|
|
527
|
-
- Events are enqueued in SystemEventQueue, then WakeManager handles delivery
|
|
528
|
-
|
|
529
|
-
### Task Dispatch (Autonomous Mode)
|
|
530
|
-
|
|
531
|
-
Opt-in autonomous dispatch mode powered by [`swarm-dispatch`](https://www.npmjs.com/package/swarm-dispatch) (v0.3+). The orchestrator polls opentasks for ready work, routes to idle agents or spawns new ones, tracks lifecycle, retries failures with exponential backoff, detects stalls, and reconciles external state changes.
|
|
532
|
-
|
|
533
|
-
Enabled via `config.dispatch.enabled` in boot. The orchestrator, state machine, eligibility, concurrency, retry, continuation, and reconciliation are all provided by `swarm-dispatch` — macro-agent provides adapters for the five ports:
|
|
534
|
-
|
|
535
|
-
1. **TaskSource adapter** — wraps `TasksAdapter` (opentasks IPC) for task queries, claiming, and state transitions
|
|
536
|
-
2. **AgentRuntime adapter** — wraps `AgentManagerV2` for agent spawning, termination, and lifecycle event subscription
|
|
537
|
-
3. **MessagePort adapter** — wraps the embedded `agent-inbox` for mail-based work routing and result envelopes (via `createAgentInboxPort`)
|
|
538
|
-
4. **AgentRoster adapter** — queries inbox agent storage for idle agents to route work to before spawning
|
|
539
|
-
5. **Dispatch mode** — auto-selects `prefer-route` when MessagePort + Roster are present (mail-first, spawn-fallback); falls back to `spawn-only` when either is absent
|
|
540
|
-
|
|
541
|
-
**Boot wiring** (`boot-v2.ts`):
|
|
542
|
-
```typescript
|
|
543
|
-
import { createOrchestrator, createAgentInboxPort } from "swarm-dispatch";
|
|
544
|
-
|
|
545
|
-
const orchestrator = createOrchestrator(source, runtime, {
|
|
546
|
-
claimantId,
|
|
547
|
-
pollIntervalMs: 15_000,
|
|
548
|
-
concurrency: { global: 3 },
|
|
549
|
-
retry: { maxRetries: 3, baseDelayMs: 10_000, maxDelayMs: 300_000 },
|
|
550
|
-
continuation: { delayMs: 1_000, maxTurns: 20 },
|
|
551
|
-
reconcile: { enabled: true, intervalMs: 60_000, stallTimeoutMs: 300_000 },
|
|
552
|
-
messagePort, // agent-inbox adapter (opt-in)
|
|
553
|
-
roster, // inbox agent listing (opt-in)
|
|
554
|
-
dispatchMode, // prefer-route | spawn-only | route-only | prefer-spawn
|
|
555
|
-
});
|
|
556
|
-
await orchestrator.start();
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
The `Orchestrator` is exposed on `MacroAgentSystemV2.taskDispatcher` (optional, only present when dispatch is enabled) for observability, snapshots, and manual triggering via `dispatchNow()` / `reconcileNow()`.
|
|
560
|
-
|
|
561
|
-
**Configuration** (in `BootV2Config.dispatch`):
|
|
562
|
-
```yaml
|
|
563
|
-
dispatch:
|
|
564
|
-
enabled: true
|
|
565
|
-
pollIntervalMs: 15000 # Dispatch poll cadence
|
|
566
|
-
maxConcurrent: 3 # Global concurrency limit
|
|
567
|
-
defaultRole: worker # Role for spawned agents
|
|
568
|
-
tags: [auto] # Only dispatch tasks with these tags
|
|
569
|
-
maxRetries: 3 # Retry attempts per task
|
|
570
|
-
dispatchMode: prefer-route # route-only | spawn-only | prefer-route | prefer-spawn
|
|
571
|
-
enableMailRouting: true # Wire MessagePort via agent-inbox (default: true)
|
|
572
|
-
enableRoster: true # Wire AgentRoster via inbox agent listing (default: true)
|
|
573
|
-
continuation:
|
|
574
|
-
delayMs: 1000 # Delay before continuation re-dispatch
|
|
575
|
-
maxTurns: 20 # Max continuation turns per task
|
|
576
|
-
reconcile:
|
|
577
|
-
enabled: true
|
|
578
|
-
intervalMs: 60000 # Reconciliation cadence
|
|
579
|
-
stallTimeoutMs: 300000 # Terminate agents with no activity past this
|
|
580
|
-
eligibility:
|
|
581
|
-
minPriority: 2
|
|
582
|
-
excludeTags: [wip]
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
**Dispatch flow:**
|
|
586
|
-
1. Orchestrator polls opentasks for ready tasks
|
|
587
|
-
2. For each eligible task: check AgentRoster for idle agents → route via MessagePort if found → spawn via AgentRuntime if not
|
|
588
|
-
3. Agent works on the task; lifecycle events flow back through `onStopped`
|
|
589
|
-
4. On normal completion: check if task is still active → if yes, schedule continuation (same logical run, next turn)
|
|
590
|
-
5. On abnormal exit: queue retry with exponential backoff
|
|
591
|
-
6. Reconcile tick: check external state (task closed? reassigned?), detect stalls, terminate stale agents
|
|
592
|
-
|
|
593
|
-
**Key design decisions:**
|
|
594
|
-
- Dispatch logic lives in `swarm-dispatch` (runtime-agnostic npm package), not macro-agent
|
|
595
|
-
- **Mail-first, spawn-fallback**: when MessagePort + Roster are wired, the orchestrator prefers routing to existing idle agents over spawning new ones
|
|
596
|
-
- Agents spawn parentless (`parent: null`) — the dispatcher is the coordination layer, not a parent agent
|
|
597
|
-
- **Continuation vs retry**: normal exit + still-active task = continuation (short delay, turn counter). Abnormal exit = retry (exponential backoff, attempt counter). Never mixed.
|
|
598
|
-
- Each dispatcher instance uses a unique `claimantId` (`hostname:pid:instanceHash`) for multi-instance awareness
|
|
599
|
-
- The dispatcher registers itself as an agent in the inbox (`dispatcher:<claimantId>`) to receive mail-based work delegation from other agents
|
|
600
|
-
- **Cancellation propagation**: spawned agents are terminated via `runtime.terminate`; routed agents receive `x-dispatch/cancel` messages via MessagePort
|
|
601
|
-
- `promptUntilDone()` auto-terminates the agent when `done()` signals `shouldTerminate: true`
|
|
602
|
-
- See [swarm-dispatch README](https://www.npmjs.com/package/swarm-dispatch) for the full API
|
|
603
|
-
|
|
604
|
-
### Agent Detection
|
|
605
|
-
|
|
606
|
-
The `agent-detection/` module discovers installed CLI coding agents on the system (e.g., Claude Code, Codex, Goose). It:
|
|
607
|
-
- Scans PATH for known binaries
|
|
608
|
-
- Extracts version information
|
|
609
|
-
- Builds headless invocation commands with proper flags
|
|
610
|
-
- Supports custom agent definitions via `additionalAgents` config
|
|
611
|
-
|
|
612
|
-
### ACP Protocol Server
|
|
613
|
-
|
|
614
|
-
The `acp/` module bridges the Agent Client Protocol (ACP) to macro-agent's V2 services:
|
|
615
|
-
- **MacroAgent** (`macro-agent.ts`): Implements the ACP Agent interface — maps `session/new` → `agentManager.getOrCreateHeadManager()`, `session/prompt` → streaming `agentManager.prompt()`, and extension methods for spawn/mount/fork/hierarchy/tasks
|
|
616
|
-
- **WebSocketACPServer** (`websocket-server.ts`): Optional WebSocket transport for ACP clients (enabled via `config.acp.enabled` in boot)
|
|
617
|
-
- **SessionMapper** (`session-mapper.ts`): Maps ACP sessions to macro-agent agent states
|
|
618
|
-
- **MAPBridge** (`map-bridge.ts`): Bridges MAP protocol to macro-agent for external observability
|
|
619
|
-
|
|
620
|
-
### MAP Capabilities
|
|
621
|
-
|
|
622
|
-
Capabilities are declared at two levels:
|
|
623
|
-
|
|
624
|
-
**Connection-level** (sidecar, `src/map/sidecar.ts`): Declared when the sidecar connects to the OpenHive MAP hub. These describe the swarm's general capabilities:
|
|
625
|
-
|
|
626
|
-
- `messaging: { canSend: true, canReceive: true }` — can exchange MAP scope messages
|
|
627
|
-
- `mail: { canCreate: true, canJoin: true, canViewHistory: true }` — supports agent-inbox conversations (enables Mail chat mode in OpenHive)
|
|
628
|
-
- `trajectory: { canReport: true, canServeContent: false }` — reports checkpoints (does not serve content on demand)
|
|
629
|
-
- `tasks: { canCreate, canAssign, canUpdate, canList }` — task management
|
|
630
|
-
|
|
631
|
-
**Per-agent** (lifecycle bridge, `src/map/lifecycle-bridge.ts`): Declared when agents register on the hub via `map/agents/register`. ACP is per-agent because you connect to a specific agent, not to the swarm:
|
|
632
|
-
|
|
633
|
-
- **Coordinators** (head managers): `protocols: ['acp']`, `acp: { version: '2024-10-07' }`, `messaging: { canReceive: true }` — enables ACP streaming chat in OpenHive
|
|
634
|
-
- **Workers**: `messaging: { canReceive: true }` — no ACP
|
|
635
|
-
|
|
636
|
-
The hub aggregates per-agent capabilities into the swarm record (union semantics). OpenHive resolves the ACP target by finding the first registered agent with `protocols: ['acp']` on the live connection.
|
|
637
|
-
|
|
638
|
-
The lifecycle bridge uses `map/agents/register` (not `map/agents/spawn`) to register agents on the hub, because `spawn` drops the `capabilities` field. The bridge tracks MAP-assigned ULIDs (`mapId`) for correct unregistration.
|
|
639
|
-
|
|
640
|
-
Message delivery is **push-based**: `InboxAdapter.onDelivery()` fires immediately on message receipt, the trigger system maps importance → wake action, and `WakeManager` injects into the active session via inject/interrupt/prompt fallback chain.
|
|
641
|
-
|
|
642
|
-
### REST API Server
|
|
643
|
-
|
|
644
|
-
The `api/` module provides HTTP endpoints for external integration:
|
|
645
|
-
- Agent CRUD and listing
|
|
646
|
-
- Task operations
|
|
647
|
-
- Team management
|
|
648
|
-
- Metrics endpoint (powered by `metrics/` module)
|
|
649
|
-
- Enabled via `config.api.enabled` in boot, configurable host/port
|
|
650
|
-
|
|
651
|
-
### Cognitive-Core Backend
|
|
652
|
-
|
|
653
|
-
The `cognitive/` module implements cognitive-core's `AgentBackend` interface, enabling macro-agent to serve as a compute backend for OpenHive:
|
|
654
|
-
- **MacroAgentBackend** (`macro-agent-backend.ts`): Spawns analyst agents, tracks sessions, manages timeouts, reports completion via callbacks and InboxAdapter
|
|
655
|
-
- **AnalystRole** (`analyst-role.ts`): Custom role definition for cognitive analysis tasks
|
|
656
|
-
- **SessionConverter** (`session-converter.ts`): Converts between cognitive-core and macro-agent session formats
|
|
657
|
-
- **WorkspaceHandler** (`workspace-handler.ts`): Workspace operations for cognitive backend tasks
|
|
658
|
-
- Design principle: the swarm is pure compute — receive task, execute agent, return result. Atlas, trajectory extraction, and team coordination are handled by OpenHive.
|
|
659
|
-
|
|
660
|
-
### Federation
|
|
661
|
-
|
|
662
|
-
The `adapters/federation.ts` module enables cross-instance communication:
|
|
663
|
-
- Multiple macro-agent instances federate their embedded agent-inbox instances
|
|
664
|
-
- Federated addressing: `agentId@systemId` (e.g., `coordinator@dev-laptop`)
|
|
665
|
-
- Cross-instance spawn via convention-based inbox messages (`remote_spawn_request` events)
|
|
666
|
-
- Trust policy: configurable `allowedSystems` whitelist
|
|
667
|
-
- Setup via `config.federation` in boot, cleanup on shutdown
|
|
668
|
-
|
|
669
|
-
### Metrics
|
|
670
|
-
|
|
671
|
-
The `metrics/` module provides point-in-time system observability:
|
|
672
|
-
- `collectMetrics()` gathers agent, task, and system metrics into a `MetricsSnapshot`
|
|
673
|
-
- Agent metrics: total/running/stopped/failed counts, unhealthy agent detection
|
|
674
|
-
- Task metrics: total/open/in-progress/closed counts
|
|
675
|
-
- System metrics: uptime, health check status
|
|
676
|
-
- Used by the REST API server's `/metrics` endpoint
|
|
677
|
-
|
|
678
|
-
### AI Router Strategy
|
|
679
|
-
|
|
680
|
-
The `trigger/strategies/ai-router.ts` provides an AI-powered routing strategy:
|
|
681
|
-
- Spawns a temporary Claude session to make routing decisions for trigger events
|
|
682
|
-
- Falls back to "head" strategy if spawning fails or times out
|
|
683
|
-
- Selected when `routing.target.type === "ai-router"`
|
|
684
|
-
- Expensive — intended for events that genuinely need intelligent routing
|
|
685
|
-
|
|
686
|
-
### Communication Topology
|
|
687
|
-
|
|
688
|
-
Teams configure communication via:
|
|
689
|
-
- **Channels**: Named topics with defined signals
|
|
690
|
-
- **Subscriptions**: Per-role channel subscriptions with optional signal filters
|
|
691
|
-
- **Peer routing**: Directional connections with per-peer signal filters
|
|
692
|
-
- **Emissions**: Per-role allowed signal lists
|
|
693
|
-
- **Enforcement**: `strict` (reject), `permissive` (warn), `audit` (log)
|
|
694
|
-
|
|
695
|
-
All filtering is adapter-side — agent-inbox is a dumb pipe, macro-agent enforces policy via composite filters on the InboxAdapter.
|
|
696
|
-
|
|
697
|
-
### Done Handler Flow
|
|
698
|
-
|
|
699
|
-
1. Agent calls `done()` MCP tool with status + summary
|
|
700
|
-
2. MCPServerV2 dispatches to `createDoneHandlerV2()` which builds a handler using `HandlerDepsV2` (InboxAdapter, TasksAdapter, AgentManager)
|
|
701
|
-
3. Role-specific handler runs:
|
|
702
|
-
- **Worker / V3 streamed agent**: Commits changes via `commitChanges` (Change-Id tracked), invokes `LandingStrategy.land()` per YAML config, emits `work:done` signal
|
|
703
|
-
- **Coordinator**: Emits completion signal, cascade-terminates children if needed
|
|
704
|
-
- **Monitor**: Emits health report
|
|
705
|
-
4. If landing returns a conflict, the recovery dispatcher selects a `ConflictRecoveryStrategy` per role's `on_conflict_recovery` YAML (or team default); strategy runs sync or async
|
|
706
|
-
5. If `shouldTerminate`, AgentManagerV2 handles termination: `TopologyPolicy.onAgentComplete` deallocates the worktree; cascade termination consolidates changes for child agents
|
|
707
|
-
|
|
708
|
-
## Conventions
|
|
709
|
-
|
|
710
|
-
### File Organization
|
|
711
|
-
|
|
712
|
-
- **One module per file** - Export from index.ts
|
|
713
|
-
- **Tests colocated** - `__tests__/` directory alongside source
|
|
714
|
-
- **Types separate** - `types.ts` for interface definitions
|
|
715
|
-
|
|
716
|
-
### Naming
|
|
717
|
-
|
|
718
|
-
- **camelCase** for functions and variables
|
|
719
|
-
- **PascalCase** for types and classes
|
|
720
|
-
- **kebab-case** for file names
|
|
721
|
-
- **SCREAMING_SNAKE** for constants
|
|
722
|
-
|
|
723
|
-
### Testing
|
|
724
|
-
|
|
725
|
-
- **Unit tests**: `*.test.ts` — Fast tests, mixed real-git and mocked dependencies (~58 test files, ~990 tests)
|
|
726
|
-
- **E2E tests**: `*.e2e.test.ts` — Full system tests gated by `RUN_E2E_TESTS=true`
|
|
727
|
-
|
|
728
|
-
Run tests:
|
|
729
|
-
```bash
|
|
730
|
-
npm test # Run all unit tests (watch mode)
|
|
731
|
-
npx vitest run # Run all unit tests (single run)
|
|
732
|
-
npm run test:e2e # E2E tests (mocked agent sessions)
|
|
733
|
-
npm run test:e2e-full-agents # E2E tests with real agent spawning (RUN_FULL_AGENT_TESTS=true)
|
|
734
|
-
```
|
|
735
|
-
|
|
736
|
-
E2E test files (selected):
|
|
737
|
-
- `agent-lifecycle.e2e.test.ts` — Spawn, prompt, terminate flows
|
|
738
|
-
- `workspace-lifecycle.e2e.test.ts` — Legacy capability-based workspace path (programmatic API)
|
|
739
|
-
- `workspace-v3.e2e.test.ts` — V3 YAML-driven path: peer swarm, merge-to-parent landing, conflict recovery, legacy regression guard
|
|
740
|
-
- `cognitive-workspace.e2e.test.ts` — Cognitive-core backend workspace operations
|
|
741
|
-
- `done-scenarios.e2e.test.ts` — Done handler scenarios per role
|
|
742
|
-
- `trigger-wake.e2e.test.ts` — Trigger delivery and wake flows
|
|
743
|
-
- `resume-continue.e2e.test.ts` — Session continuation
|
|
744
|
-
- `pull-mode.e2e.test.ts` — Task claiming workflows
|
|
745
|
-
- `opentasks-integration.e2e.test.ts` — TasksAdapter integration
|
|
746
|
-
- `live-agent.e2e.test.ts` — Full agent with real Claude Code (requires `RUN_FULL_AGENT_TESTS`)
|
|
747
|
-
- `dispatch.e2e.test.ts` — Task dispatch Phase 1 boot wiring via swarm-dispatch (mocked agents)
|
|
748
|
-
- `dispatch-phase2.e2e.test.ts` — Task dispatch Phase 2 boot wiring: MessagePort, AgentRoster, dispatch modes, snapshot, stall config (mocked agents)
|
|
749
|
-
- `dispatch-live.e2e.test.ts` — Task dispatch with real agents via swarm-dispatch (requires `RUN_FULL_AGENT_TESTS`)
|
|
750
|
-
- `dispatch-phase2-live.e2e.test.ts` — Task dispatch Phase 2 with real agents: prefer-route fallback, snapshot, lifecycle tracking, reconciliation (requires `RUN_FULL_AGENT_TESTS`)
|
|
751
|
-
- `dispatch-opentasks.e2e.test.ts` — Task dispatch with real agents + real opentasks daemon via swarm-dispatch (requires `RUN_FULL_AGENT_TESTS`)
|
|
752
|
-
- `dispatch-coordination.e2e.test.ts` — Dispatch coordination with mock MAP connection
|
|
753
|
-
- `conflict-resolution-git.e2e.test.ts` — Git merge conflict handling
|
|
754
|
-
- `real-git-operations.e2e.test.ts` — Real git worktree operations
|
|
755
|
-
|
|
756
|
-
### Error Handling
|
|
757
|
-
|
|
758
|
-
- Use typed errors with codes (`AgentManagerError`, `MCPToolError`, `AgentDetectionError`)
|
|
759
|
-
- Graceful degradation over hard failures (e.g., opentasks daemon not available is non-fatal)
|
|
760
|
-
- Log warnings for recoverable issues
|
|
761
|
-
|
|
762
|
-
## Common Tasks
|
|
763
|
-
|
|
764
|
-
### Adding a New MCP Tool (macro-agent specific)
|
|
765
|
-
|
|
766
|
-
1. Define Zod schema in `src/mcp/mcp-server-v2.ts` (or separate file for complex tools)
|
|
767
|
-
2. Add `server.registerTool()` call inside `createMCPServerV2()`, gated by `shouldRegister(toolName)`
|
|
768
|
-
3. If the tool needs lifecycle access, use `agentManager` (via ControlClient in subprocess, or directly in main process)
|
|
769
|
-
4. If the tool needs messaging, use `inboxAdapter.send()`
|
|
770
|
-
|
|
771
|
-
### Adding a New Built-in Role
|
|
772
|
-
|
|
773
|
-
1. Create `src/roles/builtin/your_role.ts`
|
|
774
|
-
2. Define `RoleDefinition` with capabilities
|
|
775
|
-
3. Register in `src/roles/builtin/index.ts`
|
|
776
|
-
4. Update `isToolAllowedForRole()` in `src/roles/registry.ts` if needed
|
|
777
|
-
|
|
778
|
-
### Adding a Team Role (via YAML)
|
|
779
|
-
|
|
780
|
-
1. Create `.multiagent/teams/<team>/roles/<role>.yaml` with `extends` base role
|
|
781
|
-
2. Add `capabilities_add`/`capabilities_remove` as needed
|
|
782
|
-
3. Create `.multiagent/teams/<team>/prompts/<role>.md` for custom prompt
|
|
783
|
-
4. Reference the role in `team.yaml` topology and communication sections
|
|
784
|
-
|
|
785
|
-
### Adding a Routing Strategy
|
|
786
|
-
|
|
787
|
-
1. Implement the `RoutingStrategy` interface from `src/trigger/trigger-system-v2.ts`
|
|
788
|
-
2. Define `name`, `route()`, and optionally `canHandle()`, `initialize()`, `cleanup()`
|
|
789
|
-
3. Register with `triggerSystem.router.registerStrategy(strategy)`
|
|
790
|
-
4. Optionally set as default: `triggerSystem.router.setDefaultStrategy(name)`
|
|
791
|
-
|
|
792
|
-
### Adding a Landing Strategy (V3)
|
|
793
|
-
|
|
794
|
-
1. Implement the `LandingStrategy` interface from `src/workspace/types-v3.ts`
|
|
795
|
-
2. Define `name`, `land(ctx)`, optionally `canLand(ctx)`, `initialize()`, `close()`
|
|
796
|
-
3. Register via `workspaceManager.registerLandingStrategy(new YourStrategy())` (typically at boot after built-ins)
|
|
797
|
-
4. Reference from team YAML: `roles.<role>.landing: your_strategy_name`; pass config via `landing_config`
|
|
798
|
-
|
|
799
|
-
### Adding a Conflict Recovery Strategy (V3)
|
|
800
|
-
|
|
801
|
-
1. Implement the `ConflictRecoveryStrategy` interface from `src/workspace/recovery/types.ts`
|
|
802
|
-
2. Define `name`, `mode` (`sync` | `async`), `recover(ctx)`, optionally `canHandle(ctx)`
|
|
803
|
-
3. If the strategy needs `AgentManager` (like `spawn-resolver`), expose a factory that accepts it
|
|
804
|
-
4. Register into the team's recovery registry; selected per-role via `on_conflict_recovery:` or team default
|
|
805
|
-
|
|
806
|
-
### Adding a Topology Policy (V3)
|
|
807
|
-
|
|
808
|
-
1. Implement the `TopologyPolicy` interface from `src/workspace/topology/types.ts`
|
|
809
|
-
2. Define `onTeamStart`, `onAgentSpawn`, `onAgentComplete`, `onTeamStop`
|
|
810
|
-
3. Return `WorkspaceDecision` values from `onAgentSpawn` (`none` / `share-parent-cwd` / `share-with-agent` / `attach-to-stream` / `new-stream`)
|
|
811
|
-
4. Inject via `agentManager.setTopologyPolicy(policy)` — or have `TeamManagerV2.startTeam` auto-wire from YAML via `YamlDrivenTopology`
|
|
812
|
-
|
|
813
|
-
### Adding a Control Command
|
|
814
|
-
|
|
815
|
-
1. Add the command type to `ControlCommand` union in `src/control/types.ts`
|
|
816
|
-
2. Handle the command in `ControlServer.handleCommand()` in `src/control/control-server.ts`
|
|
817
|
-
3. Add typed method on `ControlClient` in `src/control/control-client.ts`
|
|
818
|
-
|
|
819
|
-
## Environment Variables
|
|
820
|
-
|
|
821
|
-
### Set by boot-v2 / system config
|
|
822
|
-
|
|
823
|
-
| Variable | Description | Default |
|
|
824
|
-
|----------|-------------|---------|
|
|
825
|
-
| `MACRO_BASE_DIR` | Base directory for data storage | `~/.macro-agent` |
|
|
826
|
-
| `MACRO_WORKSPACE_POOL_SIZE` | Max concurrent workspaces | `10` |
|
|
827
|
-
| `MACRO_MERGE_QUEUE_DB` | Merge queue SQLite path | `:memory:` |
|
|
828
|
-
| `MACRO_TEAMS` | Comma-separated team templates to auto-start | -- |
|
|
829
|
-
| `MACRO_AGENT_HOME` | Alternative base directory (used by CLI clear) | `~/.macro-agent` |
|
|
830
|
-
|
|
831
|
-
### Boot config options (BootV2Config)
|
|
832
|
-
|
|
833
|
-
| Option | Description | Default |
|
|
834
|
-
|--------|-------------|---------|
|
|
835
|
-
| `api.enabled` | Start REST API server | `false` |
|
|
836
|
-
| `api.port` | REST API port | -- |
|
|
837
|
-
| `acp.enabled` | Start ACP WebSocket server | `false` |
|
|
838
|
-
| `acp.port` | ACP WebSocket port | -- |
|
|
839
|
-
| `federation.systemId` | Unique instance ID for federation | -- |
|
|
840
|
-
| `federation.peers` | Peer instances to federate with | `[]` |
|
|
841
|
-
| `federation.trust.allowedSystems` | Trusted system ID whitelist | -- |
|
|
842
|
-
| `dispatch.enabled` | Enable autonomous task dispatch mode | `false` |
|
|
843
|
-
| `dispatch.pollIntervalMs` | Dispatch poll cadence (ms) | `15000` |
|
|
844
|
-
| `dispatch.maxConcurrent` | Max concurrent dispatched agents | `3` |
|
|
845
|
-
| `dispatch.defaultRole` | Role for spawned agents | `"worker"` |
|
|
846
|
-
| `dispatch.tags` | Only dispatch tasks with these tags | -- |
|
|
847
|
-
| `dispatch.maxRetries` | Retry attempts per failed task | `3` |
|
|
848
|
-
| `dispatch.dispatchMode` | `route-only`, `spawn-only`, `prefer-route`, `prefer-spawn` | auto (`prefer-route` if inbox wired) |
|
|
849
|
-
| `dispatch.enableMailRouting` | Wire MessagePort via agent-inbox | `true` |
|
|
850
|
-
| `dispatch.enableRoster` | Wire AgentRoster via inbox agent listing | `true` |
|
|
851
|
-
| `dispatch.continuation.delayMs` | Delay before continuation re-dispatch (ms) | `1000` |
|
|
852
|
-
| `dispatch.continuation.maxTurns` | Max continuation turns per task | `20` |
|
|
853
|
-
| `dispatch.reconcile.enabled` | Enable external state reconciliation | `true` |
|
|
854
|
-
| `dispatch.reconcile.intervalMs` | Reconciliation cadence (ms) | `60000` |
|
|
855
|
-
| `dispatch.reconcile.stallTimeoutMs` | Terminate agents with no activity past this (ms) | `300000` |
|
|
856
|
-
|
|
857
|
-
### Injected into MCP subprocesses (by AgentManagerV2)
|
|
858
|
-
|
|
859
|
-
| Variable | Description |
|
|
860
|
-
|----------|-------------|
|
|
861
|
-
| `MACRO_AGENT_ID` | ID of the calling agent |
|
|
862
|
-
| `MACRO_PARENT_ID` | Parent agent ID |
|
|
863
|
-
| `MACRO_TASK_ID` | Task ID |
|
|
864
|
-
| `MACRO_AGENT_CWD` | Working directory |
|
|
865
|
-
| `MACRO_PERMISSION_MODE` | Permission mode |
|
|
866
|
-
| `MACRO_SESSION_ID` | Session ID |
|
|
867
|
-
| `MACRO_STREAM_ID` | Workspace stream ID |
|
|
868
|
-
| `MACRO_AGENT_LINEAGE` | JSON array of ancestor agent IDs |
|
|
869
|
-
| `MACRO_CONTROL_SOCKET_PATH` | Control socket for lifecycle RPC |
|
|
870
|
-
| `INBOX_SOCKET_PATH` | agent-inbox IPC socket path |
|
|
871
|
-
|
|
872
|
-
### Injected by team runtime
|
|
873
|
-
|
|
874
|
-
| Variable | Description |
|
|
875
|
-
|----------|-------------|
|
|
876
|
-
| `MACRO_TEAM_NAME` | Team name |
|
|
877
|
-
| `MACRO_TASK_MODE` | Task mode: `push` or `pull` |
|
|
878
|
-
| `MACRO_INTEGRATION_STRATEGY` | Integration strategy name |
|
|
879
|
-
|
|
880
|
-
## Dependencies
|
|
881
|
-
|
|
882
|
-
### Runtime
|
|
883
|
-
|
|
884
|
-
| Package | Purpose |
|
|
885
|
-
|---------|---------|
|
|
886
|
-
| `agent-inbox` | Messaging, threading, federation (embedded in-process) |
|
|
887
|
-
| `opentasks` | Task graph, dependencies, providers (IPC to daemon) |
|
|
888
|
-
| `acp-factory` | Agent process management (Claude Code sessions) |
|
|
889
|
-
| `swarm-dispatch` | Autonomous task dispatch orchestrator (poll, route, spawn, continuation, retry, reconcile, mail-inbound, roster-aware) |
|
|
890
|
-
| `openteams` | Team template loading and resolution |
|
|
891
|
-
| `git-cascade` | Git worktree, stream/fork/merge/rebase, Change-Id tracking, cascade namespace, event emitter (0.0.3+) |
|
|
892
|
-
| `better-sqlite3` | AgentStore + InboxAdapter persistence |
|
|
893
|
-
| `@modelcontextprotocol/sdk` | MCP server implementation |
|
|
894
|
-
| `@multi-agent-protocol/sdk` | MAP protocol types |
|
|
895
|
-
| `@sudocode-ai/claude-code-acp` | Claude Code ACP adapter |
|
|
896
|
-
| `zod` | Schema validation for MCP tools |
|
|
897
|
-
| `commander` | CLI argument parsing |
|
|
898
|
-
| `chalk` | CLI output formatting |
|
|
899
|
-
| `js-yaml` | Team YAML config parsing |
|
|
900
|
-
| `nanoid` | ID generation |
|
|
901
|
-
| `unique-names-generator` | Human-readable agent names |
|
|
902
|
-
| `express` | REST API server |
|
|
903
|
-
| `ws` | ACP WebSocket transport |
|
|
904
|
-
|
|
905
|
-
### Dev
|
|
906
|
-
|
|
907
|
-
| Package | Purpose |
|
|
908
|
-
|---------|---------|
|
|
909
|
-
| `vitest` | Test runner |
|
|
910
|
-
| `typescript` | Type checking and compilation |
|
|
911
|
-
| `@sudocode-ai/cli` | Sudocode CLI integration |
|
|
912
|
-
|
|
913
|
-
## References
|
|
914
|
-
|
|
915
|
-
### Team configuration
|
|
916
|
-
- [docs/teams.md](docs/teams.md) - Team template schema reference
|
|
917
|
-
- [docs/team-templates.md](docs/team-templates.md) - Team template format and examples
|
|
918
|
-
|
|
919
|
-
### Workspace redesign (V3)
|
|
920
|
-
- [docs/workspace-redesign-plan.md](docs/workspace-redesign-plan.md) - Implementation plan + status
|
|
921
|
-
- [docs/workspace-interfaces.md](docs/workspace-interfaces.md) - V3 interface contracts (TypeScript)
|
|
922
|
-
- [docs/git-cascade-integration-gaps.md](docs/git-cascade-integration-gaps.md) - Design narrative, workflow traces, migration plan
|
|
923
|
-
- [docs/conflict-recovery.md](docs/conflict-recovery.md) - Conflict recovery strategy design
|