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/src/lifecycle/cascade.ts
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cascade Termination Module
|
|
3
|
-
*
|
|
4
|
-
* Handles cascading termination of child agents when a parent agent completes.
|
|
5
|
-
* Children are terminated depth-first (grandchildren before children).
|
|
6
|
-
*
|
|
7
|
-
* Change consolidation merges child branches back to parent branches.
|
|
8
|
-
*
|
|
9
|
-
* @module lifecycle/cascade
|
|
10
|
-
* @see s-32xs Self-Cleaning Workers spec
|
|
11
|
-
* @see s-bcqm Change Management spec
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import type { AgentId } from "../store/types/index.js";
|
|
15
|
-
import type {
|
|
16
|
-
CascadeOptions,
|
|
17
|
-
CascadeResult,
|
|
18
|
-
ConsolidationResult,
|
|
19
|
-
ConsolidationOptions,
|
|
20
|
-
} from "./types.js";
|
|
21
|
-
import type { Workspace, WorkspaceManager } from "../workspace/types.js";
|
|
22
|
-
import { attemptMerge, abortMerge, getCurrentBranch } from "./cleanup.js";
|
|
23
|
-
|
|
24
|
-
// =============================================================================
|
|
25
|
-
// Agent Manager Interface (to avoid circular dependency)
|
|
26
|
-
// =============================================================================
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Minimal agent interface for cascade operations
|
|
30
|
-
*/
|
|
31
|
-
export interface CascadeAgent {
|
|
32
|
-
id: AgentId;
|
|
33
|
-
state: "running" | "spawning" | "stopped" | "failed";
|
|
34
|
-
parent?: AgentId | null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Agent manager interface for cascade operations
|
|
39
|
-
*/
|
|
40
|
-
export interface CascadeAgentManager {
|
|
41
|
-
/** Get children of an agent */
|
|
42
|
-
getChildren(agentId: AgentId): CascadeAgent[];
|
|
43
|
-
|
|
44
|
-
/** Terminate an agent */
|
|
45
|
-
terminate(agentId: AgentId, reason: string): Promise<void>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// =============================================================================
|
|
49
|
-
// Cascade Termination
|
|
50
|
-
// =============================================================================
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Cascade terminate all children of an agent (depth-first)
|
|
54
|
-
*
|
|
55
|
-
* This terminates grandchildren before children to ensure proper cleanup order.
|
|
56
|
-
*
|
|
57
|
-
* @param agentId - Parent agent ID
|
|
58
|
-
* @param agentManager - Agent manager for terminate operations
|
|
59
|
-
* @param options - Cascade options
|
|
60
|
-
* @returns Cascade result with terminated agent IDs
|
|
61
|
-
*/
|
|
62
|
-
export async function cascadeTerminateChildren(
|
|
63
|
-
agentId: AgentId,
|
|
64
|
-
agentManager: CascadeAgentManager,
|
|
65
|
-
options: CascadeOptions = { reason: "parent_stopped" }
|
|
66
|
-
): Promise<CascadeResult> {
|
|
67
|
-
const terminatedIds: AgentId[] = [];
|
|
68
|
-
const errors: Array<{ agentId: AgentId; error: string }> = [];
|
|
69
|
-
|
|
70
|
-
// Get direct children
|
|
71
|
-
const children = agentManager.getChildren(agentId);
|
|
72
|
-
|
|
73
|
-
// Process each child depth-first
|
|
74
|
-
for (const child of children) {
|
|
75
|
-
// Skip already stopped agents
|
|
76
|
-
if (child.state === "stopped") {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
// Recursively terminate grandchildren first
|
|
82
|
-
const childCascade = await cascadeTerminateChildren(
|
|
83
|
-
child.id,
|
|
84
|
-
agentManager,
|
|
85
|
-
options
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
// Accumulate results from grandchildren
|
|
89
|
-
terminatedIds.push(...childCascade.terminatedIds);
|
|
90
|
-
if (childCascade.errors) {
|
|
91
|
-
errors.push(...childCascade.errors);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Now terminate this child
|
|
95
|
-
await agentManager.terminate(child.id, options.reason);
|
|
96
|
-
terminatedIds.push(child.id);
|
|
97
|
-
} catch (error) {
|
|
98
|
-
errors.push({
|
|
99
|
-
agentId: child.id,
|
|
100
|
-
error: error instanceof Error ? error.message : String(error),
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
childrenTerminated: terminatedIds.length,
|
|
107
|
-
terminatedIds,
|
|
108
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// =============================================================================
|
|
113
|
-
// Change Consolidation (Phase 6)
|
|
114
|
-
// =============================================================================
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Workspace provider interface for change consolidation.
|
|
118
|
-
* Allows injection of workspace lookup without tight coupling.
|
|
119
|
-
*/
|
|
120
|
-
export interface WorkspaceProvider {
|
|
121
|
-
/** Get workspace for an agent */
|
|
122
|
-
getWorkspace(agentId: AgentId): Workspace | null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Terminate a child with change consolidation
|
|
127
|
-
*
|
|
128
|
-
* Merges the child's branch into the parent's branch before terminating.
|
|
129
|
-
* If a merge conflict occurs, the merge is aborted and the child is
|
|
130
|
-
* terminated with a "merge_conflict" reason.
|
|
131
|
-
*
|
|
132
|
-
* When a `workspaceManager` is provided AND both workspaces carry stream
|
|
133
|
-
* ids, the merge is routed through `workspaceManager.mergeStream()` so
|
|
134
|
-
* it flows through git-cascade's tracker — gaining a `stream.merged`
|
|
135
|
-
* cascade event that propagates to the hub via CascadeBridge. This is
|
|
136
|
-
* the primary observability win of A3 in the integration plan.
|
|
137
|
-
*
|
|
138
|
-
* Falls back to raw `attemptMerge` (unchanged behavior) when either
|
|
139
|
-
* workspace lacks a stream id or no manager is passed — so
|
|
140
|
-
* programmatic/legacy callers keep working unchanged.
|
|
141
|
-
*
|
|
142
|
-
* @param childId - Child agent to terminate
|
|
143
|
-
* @param parentId - Parent agent to consolidate changes into
|
|
144
|
-
* @param agentManager - Agent manager for operations
|
|
145
|
-
* @param workspaceProvider - Optional workspace provider for getting agent workspaces
|
|
146
|
-
* @param options - Optional consolidation options
|
|
147
|
-
* @param workspaceManager - Optional workspace manager; enables cascade-
|
|
148
|
-
* event emission on the consolidation merge when both workspaces are
|
|
149
|
-
* stream-backed.
|
|
150
|
-
* @returns ConsolidationResult indicating success or failure
|
|
151
|
-
*/
|
|
152
|
-
export async function terminateWithChangeConsolidation(
|
|
153
|
-
childId: AgentId,
|
|
154
|
-
parentId: AgentId,
|
|
155
|
-
agentManager: CascadeAgentManager,
|
|
156
|
-
workspaceProvider?: WorkspaceProvider,
|
|
157
|
-
options?: ConsolidationOptions,
|
|
158
|
-
workspaceManager?: WorkspaceManager,
|
|
159
|
-
/**
|
|
160
|
-
* Optional task reference inherited from the parent agent's metadata.
|
|
161
|
-
* When provided + routing through the tracker, threaded into the
|
|
162
|
-
* `x-cascade/stream.merged` emit so the hub's cascade_merges row records
|
|
163
|
-
* which task drove the consolidation.
|
|
164
|
-
*/
|
|
165
|
-
taskRef?: { resource_id: string; node_id: string }
|
|
166
|
-
): Promise<ConsolidationResult> {
|
|
167
|
-
// If no workspace provider, just terminate normally
|
|
168
|
-
if (!workspaceProvider) {
|
|
169
|
-
await agentManager.terminate(childId, "parent_stopped");
|
|
170
|
-
return { success: true, merged: false };
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Get workspaces for both child and parent
|
|
174
|
-
const childWorkspace = workspaceProvider.getWorkspace(childId);
|
|
175
|
-
const parentWorkspace = workspaceProvider.getWorkspace(parentId);
|
|
176
|
-
|
|
177
|
-
// If either has no workspace, just terminate normally
|
|
178
|
-
if (!childWorkspace || !parentWorkspace) {
|
|
179
|
-
await agentManager.terminate(childId, "parent_stopped");
|
|
180
|
-
return { success: true, merged: false };
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Get the child's branch name
|
|
184
|
-
const childBranch = childWorkspace.branch;
|
|
185
|
-
|
|
186
|
-
// Verify the parent worktree is on the expected branch
|
|
187
|
-
const currentParentBranch = getCurrentBranch(parentWorkspace.path);
|
|
188
|
-
if (currentParentBranch !== parentWorkspace.branch) {
|
|
189
|
-
console.warn(
|
|
190
|
-
`[cascade] Parent worktree is on '${currentParentBranch}' but expected '${parentWorkspace.branch}'`
|
|
191
|
-
);
|
|
192
|
-
// Continue with merge anyway - use the actual current branch
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Attempt to merge child branch into parent's worktree.
|
|
196
|
-
//
|
|
197
|
-
// Preferred path: route through workspaceManager.mergeStream when both
|
|
198
|
-
// workspaces have stream ids. Goes via git-cascade's tracker.mergeStream,
|
|
199
|
-
// which fires `x-cascade/stream.merged` with source/target stream ids so
|
|
200
|
-
// the hub's cascade projection + the source stream's `merged` status
|
|
201
|
-
// update in lockstep with the actual git operation.
|
|
202
|
-
if (
|
|
203
|
-
workspaceManager &&
|
|
204
|
-
childWorkspace.streamId &&
|
|
205
|
-
parentWorkspace.streamId
|
|
206
|
-
) {
|
|
207
|
-
try {
|
|
208
|
-
const result = workspaceManager.mergeStream({
|
|
209
|
-
sourceStreamId: childWorkspace.streamId,
|
|
210
|
-
targetStreamId: parentWorkspace.streamId,
|
|
211
|
-
agentId: parentId,
|
|
212
|
-
worktree: parentWorkspace.path,
|
|
213
|
-
metadata: taskRef ? { task_ref: taskRef } : undefined,
|
|
214
|
-
});
|
|
215
|
-
if (result.success) {
|
|
216
|
-
await agentManager.terminate(childId, "changes_consolidated");
|
|
217
|
-
return {
|
|
218
|
-
success: true,
|
|
219
|
-
merged: true,
|
|
220
|
-
mergeCommit: result.newHead,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
if (result.conflicts && result.conflicts.length > 0) {
|
|
224
|
-
// Tracker already aborted; emit and terminate with conflict reason.
|
|
225
|
-
console.warn(
|
|
226
|
-
`[cascade] Merge conflict consolidating ${childId} -> ${parentId} via tracker: ${result.conflicts.join(", ")}`
|
|
227
|
-
);
|
|
228
|
-
await agentManager.terminate(childId, "merge_conflict");
|
|
229
|
-
return {
|
|
230
|
-
success: false,
|
|
231
|
-
merged: false,
|
|
232
|
-
conflicts: result.conflicts,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
// Tracker returned a non-conflict failure — fall through to raw
|
|
236
|
-
// git path so we don't regress the consolidation semantics for
|
|
237
|
-
// cases the tracker can't handle (e.g., stream in unexpected
|
|
238
|
-
// status, detached HEAD, branch-name mismatches).
|
|
239
|
-
} catch (err) {
|
|
240
|
-
console.warn(
|
|
241
|
-
`[cascade] tracker.mergeStream failed consolidating ${childId} -> ${parentId}; falling back to raw git: ${err instanceof Error ? err.message : String(err)}`
|
|
242
|
-
);
|
|
243
|
-
// Fall through to raw-git path below.
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Fallback: raw git merge. Preserves pre-A3 behavior when streams
|
|
248
|
-
// aren't available (programmatic callers, legacy role-shaped
|
|
249
|
-
// workspaces) or when the tracker path bailed.
|
|
250
|
-
const mergeMessage =
|
|
251
|
-
options?.mergeMessage ??
|
|
252
|
-
`Merge changes from ${childId} (${childBranch})`;
|
|
253
|
-
|
|
254
|
-
const mergeResult = attemptMerge(childBranch, parentWorkspace.path, mergeMessage);
|
|
255
|
-
|
|
256
|
-
if (mergeResult.success) {
|
|
257
|
-
// Merge succeeded - terminate child normally
|
|
258
|
-
await agentManager.terminate(childId, "changes_consolidated");
|
|
259
|
-
return {
|
|
260
|
-
success: true,
|
|
261
|
-
merged: true,
|
|
262
|
-
mergeCommit: mergeResult.mergeCommit,
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Merge failed
|
|
267
|
-
if (mergeResult.conflicts && mergeResult.conflicts.length > 0) {
|
|
268
|
-
// Conflict detected - abort the merge and terminate with conflict status
|
|
269
|
-
abortMerge(parentWorkspace.path);
|
|
270
|
-
|
|
271
|
-
console.warn(
|
|
272
|
-
`[cascade] Merge conflict consolidating ${childId} -> ${parentId}: ${mergeResult.conflicts.join(", ")}`
|
|
273
|
-
);
|
|
274
|
-
|
|
275
|
-
// Terminate child with conflict reason
|
|
276
|
-
await agentManager.terminate(childId, "merge_conflict");
|
|
277
|
-
|
|
278
|
-
return {
|
|
279
|
-
success: false,
|
|
280
|
-
merged: false,
|
|
281
|
-
conflicts: mergeResult.conflicts,
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Non-conflict error
|
|
286
|
-
console.error(
|
|
287
|
-
`[cascade] Merge failed consolidating ${childId} -> ${parentId}: ${mergeResult.error}`
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
// Still terminate the child, but note the failure
|
|
291
|
-
await agentManager.terminate(childId, "merge_failed");
|
|
292
|
-
|
|
293
|
-
return {
|
|
294
|
-
success: false,
|
|
295
|
-
merged: false,
|
|
296
|
-
error: mergeResult.error,
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// =============================================================================
|
|
301
|
-
// Utility Functions
|
|
302
|
-
// =============================================================================
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Get all descendants of an agent (children, grandchildren, etc.)
|
|
306
|
-
*/
|
|
307
|
-
export function getAllDescendants(
|
|
308
|
-
agentId: AgentId,
|
|
309
|
-
agentManager: CascadeAgentManager
|
|
310
|
-
): CascadeAgent[] {
|
|
311
|
-
const descendants: CascadeAgent[] = [];
|
|
312
|
-
const children = agentManager.getChildren(agentId);
|
|
313
|
-
|
|
314
|
-
for (const child of children) {
|
|
315
|
-
descendants.push(child);
|
|
316
|
-
// Recursively get grandchildren
|
|
317
|
-
const grandchildren = getAllDescendants(child.id, agentManager);
|
|
318
|
-
descendants.push(...grandchildren);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
return descendants;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Check if cascade termination is needed (agent has running children)
|
|
326
|
-
*/
|
|
327
|
-
export function needsCascadeTermination(
|
|
328
|
-
agentId: AgentId,
|
|
329
|
-
agentManager: CascadeAgentManager
|
|
330
|
-
): boolean {
|
|
331
|
-
const children = agentManager.getChildren(agentId);
|
|
332
|
-
return children.some(
|
|
333
|
-
(child) => child.state === "running" || child.state === "spawning"
|
|
334
|
-
);
|
|
335
|
-
}
|
package/src/lifecycle/cleanup.ts
DELETED
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cleanup Status Detection
|
|
3
|
-
*
|
|
4
|
-
* Auto-detects workspace cleanup readiness by checking:
|
|
5
|
-
* - Uncommitted changes via git status
|
|
6
|
-
*
|
|
7
|
-
* @module lifecycle/cleanup
|
|
8
|
-
* @see s-32xs Self-Cleaning Workers spec
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
import { execSync, execFileSync } from "child_process";
|
|
14
|
-
import type { CleanupStatus, LifecycleContext } from "./types.js";
|
|
15
|
-
|
|
16
|
-
// =============================================================================
|
|
17
|
-
// Cleanup Detection Interface
|
|
18
|
-
// =============================================================================
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Dependencies for cleanup detection (currently empty — extend for V2 adapters if needed)
|
|
22
|
-
*/
|
|
23
|
-
export interface CleanupDependencies {}
|
|
24
|
-
|
|
25
|
-
// =============================================================================
|
|
26
|
-
// Git Status Helpers
|
|
27
|
-
// =============================================================================
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Check if a workspace has uncommitted changes
|
|
31
|
-
*/
|
|
32
|
-
export function hasUncommittedChanges(workspacePath: string): boolean {
|
|
33
|
-
try {
|
|
34
|
-
const status = execSync("git status --porcelain", {
|
|
35
|
-
cwd: workspacePath,
|
|
36
|
-
encoding: "utf-8",
|
|
37
|
-
});
|
|
38
|
-
return status.trim() !== "";
|
|
39
|
-
} catch {
|
|
40
|
-
// If git command fails, assume there are uncommitted changes
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Get list of uncommitted files in a workspace
|
|
47
|
-
*/
|
|
48
|
-
export function getUncommittedFiles(workspacePath: string): string[] {
|
|
49
|
-
try {
|
|
50
|
-
const status = execSync("git status --porcelain", {
|
|
51
|
-
cwd: workspacePath,
|
|
52
|
-
encoding: "utf-8",
|
|
53
|
-
});
|
|
54
|
-
if (!status.trim()) return [];
|
|
55
|
-
|
|
56
|
-
// Split by newlines, filter empty lines, then extract filename
|
|
57
|
-
// Git status format: XY FILENAME (2 char status + space + filename)
|
|
58
|
-
return status
|
|
59
|
-
.split("\n")
|
|
60
|
-
.filter((line) => line.length > 3)
|
|
61
|
-
.map((line) => line.slice(3).trim())
|
|
62
|
-
.filter(Boolean);
|
|
63
|
-
} catch {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Get current branch name
|
|
70
|
-
*/
|
|
71
|
-
export function getCurrentBranch(workspacePath: string): string | undefined {
|
|
72
|
-
try {
|
|
73
|
-
return execSync("git rev-parse --abbrev-ref HEAD", {
|
|
74
|
-
cwd: workspacePath,
|
|
75
|
-
encoding: "utf-8",
|
|
76
|
-
}).trim();
|
|
77
|
-
} catch {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// =============================================================================
|
|
83
|
-
// Main Detection Function
|
|
84
|
-
// =============================================================================
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Detect cleanup status for an agent
|
|
88
|
-
*
|
|
89
|
-
* Checks uncommitted changes in workspace.
|
|
90
|
-
* Pending message checks are handled by agent-inbox directly.
|
|
91
|
-
*
|
|
92
|
-
* @param context - Lifecycle context with agent info
|
|
93
|
-
* @param _deps - Dependencies (currently unused, reserved for future)
|
|
94
|
-
* @returns Cleanup status indicating readiness
|
|
95
|
-
*/
|
|
96
|
-
export function detectCleanupStatus(
|
|
97
|
-
context: LifecycleContext,
|
|
98
|
-
_deps: CleanupDependencies = {}
|
|
99
|
-
): CleanupStatus {
|
|
100
|
-
const reasons: string[] = [];
|
|
101
|
-
let uncommittedFiles: string[] = [];
|
|
102
|
-
|
|
103
|
-
// Check uncommitted changes if workspace path is available
|
|
104
|
-
if (context.workspacePath) {
|
|
105
|
-
uncommittedFiles = getUncommittedFiles(context.workspacePath);
|
|
106
|
-
if (uncommittedFiles.length > 0) {
|
|
107
|
-
reasons.push(
|
|
108
|
-
`${uncommittedFiles.length} uncommitted file(s): ${uncommittedFiles.slice(0, 3).join(", ")}${uncommittedFiles.length > 3 ? "..." : ""}`
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const ready = reasons.length === 0;
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
ready,
|
|
117
|
-
reason: ready ? undefined : reasons.join("; "),
|
|
118
|
-
uncommittedFiles: uncommittedFiles.length > 0 ? uncommittedFiles : undefined,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// =============================================================================
|
|
123
|
-
// Commit Changes Helper
|
|
124
|
-
// =============================================================================
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Optional handle for routing commits through git-cascade so the resulting
|
|
128
|
-
* commit gets a Change-Id trailer and emits an `x-cascade/stream.committed`
|
|
129
|
-
* event. When omitted, commits are made via raw git (no Change-Id, no
|
|
130
|
-
* cascade event) — used by legacy/null-workspace paths.
|
|
131
|
-
*/
|
|
132
|
-
export interface TrackedCommitHandle {
|
|
133
|
-
/** WorkspaceManager-style commitChanges signature */
|
|
134
|
-
commitChanges(opts: {
|
|
135
|
-
streamId: string;
|
|
136
|
-
agentId: string;
|
|
137
|
-
worktree: string;
|
|
138
|
-
message: string;
|
|
139
|
-
metadata?: Record<string, unknown>;
|
|
140
|
-
}): { commit: string; changeId: string };
|
|
141
|
-
/** Stream this commit belongs to */
|
|
142
|
-
streamId: string;
|
|
143
|
-
/** Agent making the commit */
|
|
144
|
-
agentId: string;
|
|
145
|
-
/** Optional metadata threaded into the cascade event (e.g. `{ task_ref }`) */
|
|
146
|
-
metadata?: Record<string, unknown>;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Commit all uncommitted changes in a workspace.
|
|
151
|
-
*
|
|
152
|
-
* When a `TrackedCommitHandle` is supplied, the commit goes through
|
|
153
|
-
* git-cascade's tracker — gaining a stable Change-Id trailer and emitting
|
|
154
|
-
* `x-cascade/stream.committed` so OpenHive sees the work. Without a handle,
|
|
155
|
-
* falls back to raw git (legacy behavior).
|
|
156
|
-
*
|
|
157
|
-
* @param workspacePath - Path to the workspace
|
|
158
|
-
* @param message - Commit message
|
|
159
|
-
* @param tracked - Optional handle to commit via the cascade tracker
|
|
160
|
-
* @returns Commit hash if successful, undefined if nothing to commit
|
|
161
|
-
*/
|
|
162
|
-
export function commitChanges(
|
|
163
|
-
workspacePath: string,
|
|
164
|
-
message: string,
|
|
165
|
-
tracked?: TrackedCommitHandle
|
|
166
|
-
): string | undefined {
|
|
167
|
-
try {
|
|
168
|
-
// Check if there are changes to commit
|
|
169
|
-
if (!hasUncommittedChanges(workspacePath)) {
|
|
170
|
-
return undefined;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Tracked path: stage + commit through git-cascade so Change-Id +
|
|
174
|
-
// x-cascade events fire.
|
|
175
|
-
if (tracked) {
|
|
176
|
-
try {
|
|
177
|
-
const { commit } = tracked.commitChanges({
|
|
178
|
-
streamId: tracked.streamId,
|
|
179
|
-
agentId: tracked.agentId,
|
|
180
|
-
worktree: workspacePath,
|
|
181
|
-
message,
|
|
182
|
-
metadata: tracked.metadata,
|
|
183
|
-
});
|
|
184
|
-
return commit;
|
|
185
|
-
} catch {
|
|
186
|
-
// Fall through to raw-git path on tracker failure (e.g., stream
|
|
187
|
-
// conflicted) so callers still get a commit. Caveat: no Change-Id
|
|
188
|
-
// and no cascade event in this fallback.
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// Raw-git path: stage all changes
|
|
193
|
-
execFileSync("git", ["add", "--all"], {
|
|
194
|
-
cwd: workspacePath,
|
|
195
|
-
encoding: "utf-8",
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// Commit - use execFileSync with array args to prevent command injection
|
|
199
|
-
execFileSync("git", ["commit", "-m", message], {
|
|
200
|
-
cwd: workspacePath,
|
|
201
|
-
encoding: "utf-8",
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// Get commit hash
|
|
205
|
-
const hash = execSync("git rev-parse HEAD", {
|
|
206
|
-
cwd: workspacePath,
|
|
207
|
-
encoding: "utf-8",
|
|
208
|
-
}).trim();
|
|
209
|
-
|
|
210
|
-
return hash;
|
|
211
|
-
} catch {
|
|
212
|
-
return undefined;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// =============================================================================
|
|
217
|
-
// Merge Helpers (Phase 6 - Change Consolidation)
|
|
218
|
-
// =============================================================================
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Result of a merge attempt
|
|
222
|
-
*/
|
|
223
|
-
export interface MergeResult {
|
|
224
|
-
/** Whether the merge succeeded */
|
|
225
|
-
success: boolean;
|
|
226
|
-
|
|
227
|
-
/** Merge commit hash if successful (only set if a new merge commit was created) */
|
|
228
|
-
mergeCommit?: string;
|
|
229
|
-
|
|
230
|
-
/** True if branches were already merged (no new commit created) */
|
|
231
|
-
alreadyMerged?: boolean;
|
|
232
|
-
|
|
233
|
-
/** List of conflicting files if merge failed */
|
|
234
|
-
conflicts?: string[];
|
|
235
|
-
|
|
236
|
-
/** Error message if merge failed for non-conflict reason */
|
|
237
|
-
error?: string;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Attempt to merge a source branch into the target branch.
|
|
242
|
-
*
|
|
243
|
-
* This performs the merge in the specified worktree, which should already
|
|
244
|
-
* be on the target branch.
|
|
245
|
-
*
|
|
246
|
-
* @param sourceBranch - Branch to merge from
|
|
247
|
-
* @param worktreePath - Path to worktree (should be on target branch)
|
|
248
|
-
* @param message - Optional merge commit message
|
|
249
|
-
* @returns MergeResult indicating success or conflict details
|
|
250
|
-
*/
|
|
251
|
-
export function attemptMerge(
|
|
252
|
-
sourceBranch: string,
|
|
253
|
-
worktreePath: string,
|
|
254
|
-
message?: string
|
|
255
|
-
): MergeResult {
|
|
256
|
-
try {
|
|
257
|
-
// Capture HEAD before merge to detect "already up-to-date" scenario
|
|
258
|
-
const headBefore = execSync("git rev-parse HEAD", {
|
|
259
|
-
cwd: worktreePath,
|
|
260
|
-
encoding: "utf-8",
|
|
261
|
-
}).trim();
|
|
262
|
-
|
|
263
|
-
// Merge with execFileSync to prevent command injection
|
|
264
|
-
const mergeMessage = message ?? `Merge branch '${sourceBranch}'`;
|
|
265
|
-
execFileSync("git", ["merge", sourceBranch, "--no-ff", "-m", mergeMessage], {
|
|
266
|
-
cwd: worktreePath,
|
|
267
|
-
encoding: "utf-8",
|
|
268
|
-
stdio: "pipe",
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
// Get HEAD after merge
|
|
272
|
-
const headAfter = execSync("git rev-parse HEAD", {
|
|
273
|
-
cwd: worktreePath,
|
|
274
|
-
encoding: "utf-8",
|
|
275
|
-
}).trim();
|
|
276
|
-
|
|
277
|
-
// Check if HEAD changed - if not, branches were already merged
|
|
278
|
-
if (headBefore === headAfter) {
|
|
279
|
-
return {
|
|
280
|
-
success: true,
|
|
281
|
-
alreadyMerged: true,
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return {
|
|
286
|
-
success: true,
|
|
287
|
-
mergeCommit: headAfter,
|
|
288
|
-
};
|
|
289
|
-
} catch (error) {
|
|
290
|
-
// Check if this is a merge conflict
|
|
291
|
-
try {
|
|
292
|
-
const status = execSync("git status --porcelain", {
|
|
293
|
-
cwd: worktreePath,
|
|
294
|
-
encoding: "utf-8",
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
// Look for unmerged files (UU, AA, DD, etc.)
|
|
298
|
-
// Note: Using regex without /g flag since we test one line at a time
|
|
299
|
-
const conflictPattern = /^(UU|AA|DD|AU|UA|DU|UD) /;
|
|
300
|
-
const conflicts: string[] = [];
|
|
301
|
-
|
|
302
|
-
for (const line of status.split("\n")) {
|
|
303
|
-
if (conflictPattern.test(line)) {
|
|
304
|
-
// Extract filename (after the status prefix)
|
|
305
|
-
const filename = line.slice(3).trim();
|
|
306
|
-
if (filename) {
|
|
307
|
-
conflicts.push(filename);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (conflicts.length > 0) {
|
|
313
|
-
return {
|
|
314
|
-
success: false,
|
|
315
|
-
conflicts,
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
} catch {
|
|
319
|
-
// Ignore status check errors
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// Non-conflict error
|
|
323
|
-
return {
|
|
324
|
-
success: false,
|
|
325
|
-
error: error instanceof Error ? error.message : String(error),
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Abort an in-progress merge.
|
|
332
|
-
*
|
|
333
|
-
* @param worktreePath - Path to worktree with merge in progress
|
|
334
|
-
* @returns true if abort succeeded, false otherwise
|
|
335
|
-
*/
|
|
336
|
-
export function abortMerge(worktreePath: string): boolean {
|
|
337
|
-
try {
|
|
338
|
-
execSync("git merge --abort", {
|
|
339
|
-
cwd: worktreePath,
|
|
340
|
-
encoding: "utf-8",
|
|
341
|
-
stdio: "pipe",
|
|
342
|
-
});
|
|
343
|
-
return true;
|
|
344
|
-
} catch {
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Check if a worktree has a merge in progress.
|
|
351
|
-
*
|
|
352
|
-
* @param worktreePath - Path to worktree
|
|
353
|
-
* @returns true if merge is in progress
|
|
354
|
-
*/
|
|
355
|
-
export function hasMergeInProgress(worktreePath: string): boolean {
|
|
356
|
-
try {
|
|
357
|
-
const gitDir = execSync("git rev-parse --git-dir", {
|
|
358
|
-
cwd: worktreePath,
|
|
359
|
-
encoding: "utf-8",
|
|
360
|
-
}).trim();
|
|
361
|
-
|
|
362
|
-
// Check for MERGE_HEAD file
|
|
363
|
-
return fs.existsSync(path.join(worktreePath, gitDir, "MERGE_HEAD"));
|
|
364
|
-
} catch {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Get the current branch of a worktree.
|
|
371
|
-
* Alias for getCurrentBranch for clarity.
|
|
372
|
-
*/
|
|
373
|
-
export { getCurrentBranch as getWorktreeBranch };
|