macro-agent 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.macro-agent/teams/self-driving/prompts/grinder.md +27 -0
- package/.macro-agent/teams/self-driving/prompts/judge.md +27 -0
- package/.macro-agent/teams/self-driving/prompts/planner.md +33 -0
- package/.macro-agent/teams/self-driving/roles/grinder.yaml +17 -0
- package/.macro-agent/teams/self-driving/roles/judge.yaml +24 -0
- package/.macro-agent/teams/self-driving/roles/planner.yaml +18 -0
- package/.macro-agent/teams/self-driving/team.yaml +103 -0
- package/.macro-agent/teams/structured/prompts/developer.md +26 -0
- package/.macro-agent/teams/structured/prompts/lead.md +25 -0
- package/.macro-agent/teams/structured/prompts/reviewer.md +24 -0
- package/.macro-agent/teams/structured/roles/developer.yaml +12 -0
- package/.macro-agent/teams/structured/roles/lead.yaml +11 -0
- package/.macro-agent/teams/structured/roles/reviewer.yaml +19 -0
- package/.macro-agent/teams/structured/team.yaml +89 -0
- package/.sudocode/issues.jsonl +56 -51
- package/.sudocode/specs.jsonl +8 -1
- package/CLAUDE.md +121 -30
- package/README.md +60 -3
- package/dist/acp/macro-agent.d.ts +4 -0
- package/dist/acp/macro-agent.d.ts.map +1 -1
- package/dist/acp/macro-agent.js +50 -4
- package/dist/acp/macro-agent.js.map +1 -1
- package/dist/acp/session-mapper.d.ts +20 -1
- package/dist/acp/session-mapper.d.ts.map +1 -1
- package/dist/acp/session-mapper.js +90 -1
- package/dist/acp/session-mapper.js.map +1 -1
- package/dist/acp/types.d.ts +24 -1
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js.map +1 -1
- package/dist/agent/agent-manager.d.ts +40 -1
- package/dist/agent/agent-manager.d.ts.map +1 -1
- package/dist/agent/agent-manager.js +172 -8
- package/dist/agent/agent-manager.js.map +1 -1
- package/dist/agent/types.d.ts +22 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/agent/wake.d.ts +15 -0
- package/dist/agent/wake.d.ts.map +1 -1
- package/dist/agent/wake.js +15 -0
- package/dist/agent/wake.js.map +1 -1
- package/dist/agent-detection/command-builder.d.ts +30 -0
- package/dist/agent-detection/command-builder.d.ts.map +1 -0
- package/dist/agent-detection/command-builder.js +71 -0
- package/dist/agent-detection/command-builder.js.map +1 -0
- package/dist/agent-detection/detector.d.ts +84 -0
- package/dist/agent-detection/detector.d.ts.map +1 -0
- package/dist/agent-detection/detector.js +240 -0
- package/dist/agent-detection/detector.js.map +1 -0
- package/dist/agent-detection/index.d.ts +12 -0
- package/dist/agent-detection/index.d.ts.map +1 -0
- package/dist/agent-detection/index.js +14 -0
- package/dist/agent-detection/index.js.map +1 -0
- package/dist/agent-detection/registry.d.ts +53 -0
- package/dist/agent-detection/registry.d.ts.map +1 -0
- package/dist/agent-detection/registry.js +177 -0
- package/dist/agent-detection/registry.js.map +1 -0
- package/dist/agent-detection/types.d.ts +121 -0
- package/dist/agent-detection/types.d.ts.map +1 -0
- package/dist/agent-detection/types.js +20 -0
- package/dist/agent-detection/types.js.map +1 -0
- package/dist/api/server.d.ts +5 -1
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +362 -0
- package/dist/api/server.js.map +1 -1
- package/dist/api/types.d.ts +50 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/cli/acp.d.ts +2 -0
- package/dist/cli/acp.d.ts.map +1 -1
- package/dist/cli/acp.js +8 -1
- package/dist/cli/acp.js.map +1 -1
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mcp.js +38 -0
- package/dist/cli/mcp.js.map +1 -1
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/project-config.d.ts +46 -0
- package/dist/config/project-config.d.ts.map +1 -0
- package/dist/config/project-config.js +68 -0
- package/dist/config/project-config.js.map +1 -0
- package/dist/lifecycle/cascade.d.ts +1 -1
- package/dist/lifecycle/cascade.d.ts.map +1 -1
- package/dist/lifecycle/handlers/index.d.ts +4 -0
- package/dist/lifecycle/handlers/index.d.ts.map +1 -1
- package/dist/lifecycle/handlers/index.js +2 -0
- package/dist/lifecycle/handlers/index.js.map +1 -1
- package/dist/lifecycle/handlers/worker.d.ts +4 -0
- package/dist/lifecycle/handlers/worker.d.ts.map +1 -1
- package/dist/lifecycle/handlers/worker.js +35 -3
- package/dist/lifecycle/handlers/worker.js.map +1 -1
- package/dist/mail/conversation-map.d.ts +33 -0
- package/dist/mail/conversation-map.d.ts.map +1 -0
- package/dist/mail/conversation-map.js +61 -0
- package/dist/mail/conversation-map.js.map +1 -0
- package/dist/mail/index.d.ts +11 -0
- package/dist/mail/index.d.ts.map +1 -0
- package/dist/mail/index.js +11 -0
- package/dist/mail/index.js.map +1 -0
- package/dist/mail/mail-service.d.ts +85 -0
- package/dist/mail/mail-service.d.ts.map +1 -0
- package/dist/mail/mail-service.js +121 -0
- package/dist/mail/mail-service.js.map +1 -0
- package/dist/mail/stores/eventstore-conversation-store.d.ts +40 -0
- package/dist/mail/stores/eventstore-conversation-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-conversation-store.js +131 -0
- package/dist/mail/stores/eventstore-conversation-store.js.map +1 -0
- package/dist/mail/stores/eventstore-participant-store.d.ts +43 -0
- package/dist/mail/stores/eventstore-participant-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-participant-store.js +145 -0
- package/dist/mail/stores/eventstore-participant-store.js.map +1 -0
- package/dist/mail/stores/eventstore-thread-store.d.ts +46 -0
- package/dist/mail/stores/eventstore-thread-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-thread-store.js +118 -0
- package/dist/mail/stores/eventstore-thread-store.js.map +1 -0
- package/dist/mail/stores/eventstore-turn-store.d.ts +47 -0
- package/dist/mail/stores/eventstore-turn-store.d.ts.map +1 -0
- package/dist/mail/stores/eventstore-turn-store.js +153 -0
- package/dist/mail/stores/eventstore-turn-store.js.map +1 -0
- package/dist/mail/stores/index.d.ts +12 -0
- package/dist/mail/stores/index.d.ts.map +1 -0
- package/dist/mail/stores/index.js +12 -0
- package/dist/mail/stores/index.js.map +1 -0
- package/dist/mail/stores/types.d.ts +146 -0
- package/dist/mail/stores/types.d.ts.map +1 -0
- package/dist/mail/stores/types.js +13 -0
- package/dist/mail/stores/types.js.map +1 -0
- package/dist/mail/turn-recorder.d.ts +30 -0
- package/dist/mail/turn-recorder.d.ts.map +1 -0
- package/dist/mail/turn-recorder.js +98 -0
- package/dist/mail/turn-recorder.js.map +1 -0
- package/dist/map/adapter/acp-over-map.d.ts.map +1 -1
- package/dist/map/adapter/acp-over-map.js +32 -2
- package/dist/map/adapter/acp-over-map.js.map +1 -1
- package/dist/map/adapter/event-translator.d.ts.map +1 -1
- package/dist/map/adapter/event-translator.js +4 -0
- package/dist/map/adapter/event-translator.js.map +1 -1
- package/dist/map/adapter/extensions/agent-detection.d.ts +49 -0
- package/dist/map/adapter/extensions/agent-detection.d.ts.map +1 -0
- package/dist/map/adapter/extensions/agent-detection.js +91 -0
- package/dist/map/adapter/extensions/agent-detection.js.map +1 -0
- package/dist/map/adapter/extensions/index.d.ts +10 -1
- package/dist/map/adapter/extensions/index.d.ts.map +1 -1
- package/dist/map/adapter/extensions/index.js +39 -0
- package/dist/map/adapter/extensions/index.js.map +1 -1
- package/dist/map/adapter/extensions/resume.d.ts +47 -0
- package/dist/map/adapter/extensions/resume.d.ts.map +1 -0
- package/dist/map/adapter/extensions/resume.js +59 -0
- package/dist/map/adapter/extensions/resume.js.map +1 -0
- package/dist/map/adapter/extensions/workspace-files.d.ts +42 -0
- package/dist/map/adapter/extensions/workspace-files.d.ts.map +1 -0
- package/dist/map/adapter/extensions/workspace-files.js +338 -0
- package/dist/map/adapter/extensions/workspace-files.js.map +1 -0
- package/dist/map/adapter/mail-handler-adapter.d.ts +27 -0
- package/dist/map/adapter/mail-handler-adapter.d.ts.map +1 -0
- package/dist/map/adapter/mail-handler-adapter.js +292 -0
- package/dist/map/adapter/mail-handler-adapter.js.map +1 -0
- package/dist/map/adapter/map-adapter.d.ts +34 -10
- package/dist/map/adapter/map-adapter.d.ts.map +1 -1
- package/dist/map/adapter/map-adapter.js +110 -14
- package/dist/map/adapter/map-adapter.js.map +1 -1
- package/dist/map/adapter/rpc-handler.d.ts +4 -1
- package/dist/map/adapter/rpc-handler.d.ts.map +1 -1
- package/dist/map/adapter/rpc-handler.js +6 -0
- package/dist/map/adapter/rpc-handler.js.map +1 -1
- package/dist/map/index.d.ts +1 -0
- package/dist/map/index.d.ts.map +1 -1
- package/dist/map/index.js +2 -0
- package/dist/map/index.js.map +1 -1
- package/dist/map/types.d.ts +3 -1
- package/dist/map/types.d.ts.map +1 -1
- package/dist/map/types.js.map +1 -1
- package/dist/mcp/mcp-server.d.ts +6 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -1
- package/dist/mcp/mcp-server.js +45 -0
- package/dist/mcp/mcp-server.js.map +1 -1
- package/dist/mcp/tools/claim_task.d.ts +35 -0
- package/dist/mcp/tools/claim_task.d.ts.map +1 -0
- package/dist/mcp/tools/claim_task.js +58 -0
- package/dist/mcp/tools/claim_task.js.map +1 -0
- package/dist/mcp/tools/done.d.ts +15 -2
- package/dist/mcp/tools/done.d.ts.map +1 -1
- package/dist/mcp/tools/done.js +45 -10
- package/dist/mcp/tools/done.js.map +1 -1
- package/dist/mcp/tools/list_claimable_tasks.d.ts +38 -0
- package/dist/mcp/tools/list_claimable_tasks.d.ts.map +1 -0
- package/dist/mcp/tools/list_claimable_tasks.js +63 -0
- package/dist/mcp/tools/list_claimable_tasks.js.map +1 -0
- package/dist/mcp/tools/unclaim_task.d.ts +31 -0
- package/dist/mcp/tools/unclaim_task.d.ts.map +1 -0
- package/dist/mcp/tools/unclaim_task.js +47 -0
- package/dist/mcp/tools/unclaim_task.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +2 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/metrics.d.ts +79 -0
- package/dist/metrics/metrics.d.ts.map +1 -0
- package/dist/metrics/metrics.js +166 -0
- package/dist/metrics/metrics.js.map +1 -0
- package/dist/roles/capabilities.d.ts +1 -0
- package/dist/roles/capabilities.d.ts.map +1 -1
- package/dist/roles/capabilities.js +3 -0
- package/dist/roles/capabilities.js.map +1 -1
- package/dist/roles/types.d.ts +1 -1
- package/dist/roles/types.d.ts.map +1 -1
- package/dist/router/channels.d.ts +2 -4
- package/dist/router/channels.d.ts.map +1 -1
- package/dist/router/channels.js.map +1 -1
- package/dist/router/message-router.d.ts +85 -9
- package/dist/router/message-router.d.ts.map +1 -1
- package/dist/router/message-router.js +203 -14
- package/dist/router/message-router.js.map +1 -1
- package/dist/router/role-resolver.d.ts +10 -1
- package/dist/router/role-resolver.d.ts.map +1 -1
- package/dist/router/role-resolver.js +15 -1
- package/dist/router/role-resolver.js.map +1 -1
- package/dist/router/types.d.ts +30 -1
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/types.js.map +1 -1
- package/dist/server/combined-server.d.ts +6 -0
- package/dist/server/combined-server.d.ts.map +1 -1
- package/dist/server/combined-server.js +24 -2
- package/dist/server/combined-server.js.map +1 -1
- package/dist/store/event-store.d.ts +14 -1
- package/dist/store/event-store.d.ts.map +1 -1
- package/dist/store/event-store.js +456 -4
- package/dist/store/event-store.js.map +1 -1
- package/dist/store/types/agents.d.ts +1 -1
- package/dist/store/types/agents.d.ts.map +1 -1
- package/dist/store/types/conversations.d.ts +91 -0
- package/dist/store/types/conversations.d.ts.map +1 -0
- package/dist/store/types/conversations.js +8 -0
- package/dist/store/types/conversations.js.map +1 -0
- package/dist/store/types/events.d.ts +1 -1
- package/dist/store/types/events.d.ts.map +1 -1
- package/dist/store/types/events.js.map +1 -1
- package/dist/store/types/index.d.ts +2 -0
- package/dist/store/types/index.d.ts.map +1 -1
- package/dist/store/types/index.js +2 -0
- package/dist/store/types/index.js.map +1 -1
- package/dist/store/types/sessions.d.ts +44 -0
- package/dist/store/types/sessions.d.ts.map +1 -0
- package/dist/store/types/sessions.js +9 -0
- package/dist/store/types/sessions.js.map +1 -0
- package/dist/store/types/tasks.d.ts +2 -0
- package/dist/store/types/tasks.d.ts.map +1 -1
- package/dist/task/backend/memory.d.ts +4 -1
- package/dist/task/backend/memory.d.ts.map +1 -1
- package/dist/task/backend/memory.js +81 -0
- package/dist/task/backend/memory.js.map +1 -1
- package/dist/task/backend/types.d.ts +30 -0
- package/dist/task/backend/types.d.ts.map +1 -1
- package/dist/task/backend/types.js.map +1 -1
- package/dist/teams/index.d.ts +4 -0
- package/dist/teams/index.d.ts.map +1 -0
- package/dist/teams/index.js +4 -0
- package/dist/teams/index.js.map +1 -0
- package/dist/teams/team-loader.d.ts +20 -0
- package/dist/teams/team-loader.d.ts.map +1 -0
- package/dist/teams/team-loader.js +293 -0
- package/dist/teams/team-loader.js.map +1 -0
- package/dist/teams/team-runtime.d.ts +139 -0
- package/dist/teams/team-runtime.d.ts.map +1 -0
- package/dist/teams/team-runtime.js +613 -0
- package/dist/teams/team-runtime.js.map +1 -0
- package/dist/teams/types.d.ts +266 -0
- package/dist/teams/types.d.ts.map +1 -0
- package/dist/teams/types.js +20 -0
- package/dist/teams/types.js.map +1 -0
- package/dist/trigger/router/trigger-router.d.ts +30 -3
- package/dist/trigger/router/trigger-router.d.ts.map +1 -1
- package/dist/trigger/router/trigger-router.js +30 -3
- package/dist/trigger/router/trigger-router.js.map +1 -1
- package/dist/trigger/wake/types.d.ts +31 -5
- package/dist/trigger/wake/types.d.ts.map +1 -1
- package/dist/trigger/wake/types.js +19 -0
- package/dist/trigger/wake/types.js.map +1 -1
- package/dist/workspace/dataplane-adapter.d.ts +1 -1
- package/dist/workspace/dataplane-adapter.d.ts.map +1 -1
- package/dist/workspace/dataplane-adapter.js +1 -1
- package/dist/workspace/dataplane-adapter.js.map +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/strategies/index.d.ts +6 -0
- package/dist/workspace/strategies/index.d.ts.map +1 -0
- package/dist/workspace/strategies/index.js +5 -0
- package/dist/workspace/strategies/index.js.map +1 -0
- package/dist/workspace/strategies/optimistic.d.ts +26 -0
- package/dist/workspace/strategies/optimistic.d.ts.map +1 -0
- package/dist/workspace/strategies/optimistic.js +121 -0
- package/dist/workspace/strategies/optimistic.js.map +1 -0
- package/dist/workspace/strategies/queue.d.ts +26 -0
- package/dist/workspace/strategies/queue.d.ts.map +1 -0
- package/dist/workspace/strategies/queue.js +67 -0
- package/dist/workspace/strategies/queue.js.map +1 -0
- package/dist/workspace/strategies/registry.d.ts +37 -0
- package/dist/workspace/strategies/registry.d.ts.map +1 -0
- package/dist/workspace/strategies/registry.js +63 -0
- package/dist/workspace/strategies/registry.js.map +1 -0
- package/dist/workspace/strategies/trunk.d.ts +20 -0
- package/dist/workspace/strategies/trunk.d.ts.map +1 -0
- package/dist/workspace/strategies/trunk.js +108 -0
- package/dist/workspace/strategies/trunk.js.map +1 -0
- package/dist/workspace/strategies/types.d.ts +104 -0
- package/dist/workspace/strategies/types.d.ts.map +1 -0
- package/dist/workspace/strategies/types.js +11 -0
- package/dist/workspace/strategies/types.js.map +1 -0
- package/dist/workspace/types.d.ts +1 -1
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.d.ts +1 -1
- package/dist/workspace/workspace-manager.d.ts.map +1 -1
- package/docs/implementation-details.md +1127 -0
- package/docs/implementation-summary.md +448 -0
- package/docs/mail-integration.md +608 -0
- package/docs/plan-self-driving-support.md +433 -0
- package/docs/spec-self-driving-support.md +462 -0
- package/docs/team-templates.md +860 -0
- package/docs/teams.md +233 -0
- package/package.json +5 -3
- package/src/acp/__tests__/integration.test.ts +161 -1
- package/src/acp/__tests__/macro-agent.test.ts +95 -0
- package/src/acp/__tests__/session-persistence.test.ts +276 -0
- package/src/acp/macro-agent.ts +79 -7
- package/src/acp/session-mapper.ts +108 -1
- package/src/acp/types.ts +33 -1
- package/src/agent/agent-manager.ts +278 -6
- package/src/agent/types.ts +27 -0
- package/src/agent/wake.ts +15 -0
- package/src/agent-detection/__tests__/command-builder.test.ts +336 -0
- package/src/agent-detection/__tests__/detector.test.ts +768 -0
- package/src/agent-detection/__tests__/registry.test.ts +254 -0
- package/src/agent-detection/command-builder.ts +90 -0
- package/src/agent-detection/detector.ts +307 -0
- package/src/agent-detection/index.ts +36 -0
- package/src/agent-detection/registry.ts +200 -0
- package/src/agent-detection/types.ts +184 -0
- package/src/api/__tests__/conversation-api.test.ts +468 -0
- package/src/api/server.ts +425 -1
- package/src/api/types.ts +64 -1
- package/src/cli/acp.ts +9 -1
- package/src/cli/index.ts +44 -0
- package/src/cli/mcp.ts +47 -0
- package/src/config/index.ts +9 -0
- package/src/config/project-config.ts +107 -0
- package/src/lifecycle/cascade.ts +1 -1
- package/src/lifecycle/handlers/index.ts +8 -0
- package/src/lifecycle/handlers/worker.ts +48 -3
- package/src/mail/__tests__/conversation-lifecycle.test.ts +409 -0
- package/src/mail/__tests__/eventstore-stores.test.ts +1073 -0
- package/src/mail/__tests__/mail-full-agent.e2e.test.ts +575 -0
- package/src/mail/__tests__/mail-integration.test.ts +759 -0
- package/src/mail/__tests__/mail-map-protocol.e2e.test.ts +1068 -0
- package/src/mail/__tests__/mail-service.test.ts +506 -0
- package/src/mail/__tests__/turn-recorder.test.ts +328 -0
- package/src/mail/conversation-map.ts +107 -0
- package/src/mail/index.ts +25 -0
- package/src/mail/mail-service.ts +257 -0
- package/src/mail/stores/eventstore-conversation-store.ts +146 -0
- package/src/mail/stores/eventstore-participant-store.ts +172 -0
- package/src/mail/stores/eventstore-thread-store.ts +129 -0
- package/src/mail/stores/eventstore-turn-store.ts +173 -0
- package/src/mail/stores/index.ts +12 -0
- package/src/mail/stores/types.ts +160 -0
- package/src/mail/turn-recorder.ts +124 -0
- package/src/map/README.md +79 -0
- package/src/map/adapter/__tests__/extensions.test.ts +359 -0
- package/src/map/adapter/__tests__/map-adapter.test.ts +90 -0
- package/src/map/adapter/__tests__/workspace-files.test.ts +673 -0
- package/src/map/adapter/acp-over-map.ts +45 -2
- package/src/map/adapter/event-translator.ts +4 -0
- package/src/map/adapter/extensions/agent-detection.ts +201 -0
- package/src/map/adapter/extensions/index.ts +63 -0
- package/src/map/adapter/extensions/resume.ts +114 -0
- package/src/map/adapter/extensions/workspace-files.ts +449 -0
- package/src/map/adapter/mail-handler-adapter.ts +429 -0
- package/src/map/adapter/map-adapter.ts +173 -27
- package/src/map/adapter/rpc-handler.ts +8 -1
- package/src/map/index.ts +3 -0
- package/src/map/types.ts +3 -1
- package/src/mcp/mcp-server.ts +67 -0
- package/src/mcp/tools/claim_task.ts +86 -0
- package/src/mcp/tools/done.ts +59 -10
- package/src/mcp/tools/list_claimable_tasks.ts +93 -0
- package/src/mcp/tools/unclaim_task.ts +71 -0
- package/src/metrics/index.ts +9 -0
- package/src/metrics/metrics.ts +280 -0
- package/src/roles/capabilities.ts +3 -0
- package/src/roles/types.ts +2 -1
- package/src/router/README.md +120 -0
- package/src/router/__tests__/message-router.test.ts +561 -0
- package/src/router/channels.ts +3 -4
- package/src/router/message-router.ts +308 -22
- package/src/router/role-resolver.ts +22 -1
- package/src/router/types.ts +36 -1
- package/src/server/combined-server.ts +36 -2
- package/src/store/README.md +134 -0
- package/src/store/event-store.ts +546 -3
- package/src/store/types/agents.ts +1 -1
- package/src/store/types/conversations.ts +129 -0
- package/src/store/types/events.ts +5 -1
- package/src/store/types/index.ts +2 -0
- package/src/store/types/sessions.ts +53 -0
- package/src/store/types/tasks.ts +3 -0
- package/src/task/backend/memory.ts +116 -0
- package/src/task/backend/types.ts +43 -0
- package/src/teams/__tests__/cross-subsystem.integration.test.ts +983 -0
- package/src/teams/__tests__/e2e/team-runtime.e2e.test.ts +553 -0
- package/src/teams/__tests__/team-system.test.ts +1280 -0
- package/src/teams/index.ts +13 -0
- package/src/teams/team-loader.ts +434 -0
- package/src/teams/team-runtime.ts +727 -0
- package/src/teams/types.ts +377 -0
- package/src/trigger/router/trigger-router.ts +30 -3
- package/src/trigger/wake/types.ts +32 -5
- package/src/trigger/wake/wake-manager.ts +2 -2
- package/src/workspace/dataplane-adapter.ts +1 -1
- package/src/workspace/index.ts +1 -1
- package/src/workspace/strategies/index.ts +18 -0
- package/src/workspace/strategies/optimistic.ts +136 -0
- package/src/workspace/strategies/queue.ts +81 -0
- package/src/workspace/strategies/registry.ts +89 -0
- package/src/workspace/strategies/trunk.ts +123 -0
- package/src/workspace/strategies/types.ts +145 -0
- package/src/workspace/types.ts +1 -1
- package/src/workspace/workspace-manager.ts +1 -1
- package/.claude/settings.local.json +0 -59
- package/dist/map/utils/address-translation.d.ts +0 -99
- package/dist/map/utils/address-translation.d.ts.map +0 -1
- package/dist/map/utils/address-translation.js +0 -285
- package/dist/map/utils/address-translation.js.map +0 -1
- package/dist/map/utils/index.d.ts +0 -7
- package/dist/map/utils/index.d.ts.map +0 -1
- package/dist/map/utils/index.js +0 -7
- package/dist/map/utils/index.js.map +0 -1
- package/openspec/AGENTS.md +0 -456
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/design.md +0 -128
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/proposal.md +0 -49
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/agent-manager/spec.md +0 -150
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/cli-api/spec.md +0 -258
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/event-store/spec.md +0 -160
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/mcp-tools/spec.md +0 -224
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/message-router/spec.md +0 -153
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/specs/task-manager/spec.md +0 -136
- package/openspec/changes/archive/2025-12-21-add-mvp-foundation/tasks.md +0 -147
- package/openspec/project.md +0 -31
- package/openspec/specs/agent-manager/spec.md +0 -154
- package/openspec/specs/cli-api/spec.md +0 -262
- package/openspec/specs/event-store/spec.md +0 -164
- package/openspec/specs/mcp-tools/spec.md +0 -228
- package/openspec/specs/message-router/spec.md +0 -157
- package/openspec/specs/task-manager/spec.md +0 -140
- package/references/acp-factory-ref/CHANGELOG.md +0 -33
- package/references/acp-factory-ref/LICENSE +0 -21
- package/references/acp-factory-ref/README.md +0 -341
- package/references/acp-factory-ref/package-lock.json +0 -3102
- package/references/acp-factory-ref/package.json +0 -96
- package/references/acp-factory-ref/python/CHANGELOG.md +0 -33
- package/references/acp-factory-ref/python/LICENSE +0 -21
- package/references/acp-factory-ref/python/Makefile +0 -57
- package/references/acp-factory-ref/python/README.md +0 -253
- package/references/acp-factory-ref/python/pyproject.toml +0 -73
- package/references/acp-factory-ref/python/tests/__init__.py +0 -0
- package/references/acp-factory-ref/python/tests/e2e/__init__.py +0 -1
- package/references/acp-factory-ref/python/tests/e2e/test_codex_e2e.py +0 -349
- package/references/acp-factory-ref/python/tests/e2e/test_gemini_e2e.py +0 -165
- package/references/acp-factory-ref/python/tests/e2e/test_opencode_e2e.py +0 -296
- package/references/acp-factory-ref/python/tests/test_client_handler.py +0 -543
- package/references/acp-factory-ref/python/tests/test_pushable.py +0 -199
- package/references/claude-code-acp/.github/workflows/ci.yml +0 -45
- package/references/claude-code-acp/.github/workflows/publish.yml +0 -34
- package/references/claude-code-acp/.prettierrc.json +0 -4
- package/references/claude-code-acp/CHANGELOG.md +0 -249
- package/references/claude-code-acp/LICENSE +0 -222
- package/references/claude-code-acp/README.md +0 -53
- package/references/claude-code-acp/docs/RELEASES.md +0 -24
- package/references/claude-code-acp/eslint.config.js +0 -48
- package/references/claude-code-acp/package-lock.json +0 -4570
- package/references/claude-code-acp/package.json +0 -88
- package/references/claude-code-acp/scripts/release.sh +0 -119
- package/references/claude-code-acp/src/acp-agent.ts +0 -2065
- package/references/claude-code-acp/src/index.ts +0 -26
- package/references/claude-code-acp/src/lib.ts +0 -38
- package/references/claude-code-acp/src/mcp-server.ts +0 -911
- package/references/claude-code-acp/src/settings.ts +0 -522
- package/references/claude-code-acp/src/tests/.claude/commands/quick-math.md +0 -5
- package/references/claude-code-acp/src/tests/.claude/commands/say-hello.md +0 -6
- package/references/claude-code-acp/src/tests/acp-agent-fork.test.ts +0 -479
- package/references/claude-code-acp/src/tests/acp-agent.test.ts +0 -1502
- package/references/claude-code-acp/src/tests/extract-lines.test.ts +0 -103
- package/references/claude-code-acp/src/tests/fork-session.test.ts +0 -335
- package/references/claude-code-acp/src/tests/replace-and-calculate-location.test.ts +0 -334
- package/references/claude-code-acp/src/tests/settings.test.ts +0 -617
- package/references/claude-code-acp/src/tests/skills-options.test.ts +0 -187
- package/references/claude-code-acp/src/tests/tools.test.ts +0 -318
- package/references/claude-code-acp/src/tests/typescript-declarations.test.ts +0 -558
- package/references/claude-code-acp/src/tools.ts +0 -819
- package/references/claude-code-acp/src/utils.ts +0 -171
- package/references/claude-code-acp/tsconfig.json +0 -18
- package/references/claude-code-acp/vitest.config.ts +0 -19
- package/references/multi-agent-protocol/.sudocode/issues.jsonl +0 -82
- package/references/multi-agent-protocol/.sudocode/specs.jsonl +0 -9
- package/references/multi-agent-protocol/LICENSE +0 -21
- package/references/multi-agent-protocol/README.md +0 -113
- package/references/multi-agent-protocol/docs/00-design-specification.md +0 -460
- package/references/multi-agent-protocol/docs/01-open-questions.md +0 -1050
- package/references/multi-agent-protocol/docs/02-wire-protocol.md +0 -296
- package/references/multi-agent-protocol/docs/03-streaming-semantics.md +0 -252
- package/references/multi-agent-protocol/docs/04-error-handling.md +0 -231
- package/references/multi-agent-protocol/docs/05-connection-model.md +0 -244
- package/references/multi-agent-protocol/docs/06-visibility-permissions.md +0 -243
- package/references/multi-agent-protocol/docs/07-federation.md +0 -259
- package/references/multi-agent-protocol/docs/08-macro-agent-migration.md +0 -253
- package/references/multi-agent-protocol/package-lock.json +0 -3239
- package/references/multi-agent-protocol/package.json +0 -56
- package/references/multi-agent-protocol/schema/meta.json +0 -337
- package/references/multi-agent-protocol/schema/schema.json +0 -1828
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { IntegrationStrategy, IntegrationStrategyFactory, LandRequest, LandResult, LandResultStatus, QueueStrategyConfig, TrunkStrategyConfig, OptimisticStrategyConfig, } from "./types.js";
|
|
2
|
+
export { QueueIntegrationStrategy } from "./queue.js";
|
|
3
|
+
export { TrunkIntegrationStrategy } from "./trunk.js";
|
|
4
|
+
export { OptimisticIntegrationStrategy } from "./optimistic.js";
|
|
5
|
+
export { IntegrationStrategyRegistry, createDefaultStrategyRegistry, defaultStrategyRegistry, } from "./registry.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/strategies/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { QueueIntegrationStrategy } from "./queue.js";
|
|
2
|
+
export { TrunkIntegrationStrategy } from "./trunk.js";
|
|
3
|
+
export { OptimisticIntegrationStrategy } from "./optimistic.js";
|
|
4
|
+
export { IntegrationStrategyRegistry, createDefaultStrategyRegistry, defaultStrategyRegistry, } from "./registry.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workspace/strategies/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimistic Integration Strategy
|
|
3
|
+
*
|
|
4
|
+
* Push immediately and emit a validation event. Does NOT run build/test —
|
|
5
|
+
* validation is the judge agent's responsibility (RD5).
|
|
6
|
+
*
|
|
7
|
+
* Uses the same rebase-and-retry logic as trunk for handling push conflicts.
|
|
8
|
+
*
|
|
9
|
+
* @module workspace/strategies/optimistic
|
|
10
|
+
*/
|
|
11
|
+
import type { IntegrationStrategy, LandRequest, LandResult } from "./types.js";
|
|
12
|
+
import type { EventStore } from "../../store/event-store.js";
|
|
13
|
+
export declare class OptimisticIntegrationStrategy implements IntegrationStrategy {
|
|
14
|
+
readonly name = "optimistic";
|
|
15
|
+
private maxRetries;
|
|
16
|
+
private eventStore?;
|
|
17
|
+
constructor(config?: Record<string, unknown>);
|
|
18
|
+
/**
|
|
19
|
+
* Set the EventStore for emitting validation events.
|
|
20
|
+
* Called after construction since EventStore may not be available at strategy creation time.
|
|
21
|
+
*/
|
|
22
|
+
setEventStore(store: EventStore): void;
|
|
23
|
+
land(request: LandRequest): Promise<LandResult>;
|
|
24
|
+
private git;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=optimistic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimistic.d.ts","sourceRoot":"","sources":["../../../src/workspace/strategies/optimistic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,UAAU,EAEX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,qBAAa,6BAA8B,YAAW,mBAAmB;IACvE,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAC,CAAa;gBAEpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAK5C;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAIhC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA0FrD,OAAO,CAAC,GAAG;CAOZ"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optimistic Integration Strategy
|
|
3
|
+
*
|
|
4
|
+
* Push immediately and emit a validation event. Does NOT run build/test —
|
|
5
|
+
* validation is the judge agent's responsibility (RD5).
|
|
6
|
+
*
|
|
7
|
+
* Uses the same rebase-and-retry logic as trunk for handling push conflicts.
|
|
8
|
+
*
|
|
9
|
+
* @module workspace/strategies/optimistic
|
|
10
|
+
*/
|
|
11
|
+
import { execSync } from "child_process";
|
|
12
|
+
export class OptimisticIntegrationStrategy {
|
|
13
|
+
name = "optimistic";
|
|
14
|
+
maxRetries;
|
|
15
|
+
eventStore;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
const typedConfig = config;
|
|
18
|
+
this.maxRetries = typedConfig?.maxRetries ?? 3;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set the EventStore for emitting validation events.
|
|
22
|
+
* Called after construction since EventStore may not be available at strategy creation time.
|
|
23
|
+
*/
|
|
24
|
+
setEventStore(store) {
|
|
25
|
+
this.eventStore = store;
|
|
26
|
+
}
|
|
27
|
+
async land(request) {
|
|
28
|
+
const { workspacePath, targetBranch } = request;
|
|
29
|
+
let retryCount = 0;
|
|
30
|
+
while (retryCount <= this.maxRetries) {
|
|
31
|
+
try {
|
|
32
|
+
// Fetch latest
|
|
33
|
+
this.git(workspacePath, `fetch origin ${targetBranch}`);
|
|
34
|
+
// Rebase onto latest
|
|
35
|
+
try {
|
|
36
|
+
this.git(workspacePath, `rebase origin/${targetBranch}`);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
try {
|
|
40
|
+
this.git(workspacePath, "rebase --abort");
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
/* already clean */
|
|
44
|
+
}
|
|
45
|
+
if (retryCount >= this.maxRetries) {
|
|
46
|
+
return {
|
|
47
|
+
status: "conflict",
|
|
48
|
+
retryCount,
|
|
49
|
+
error: `Rebase conflict after ${retryCount + 1} attempts`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
retryCount++;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// Push optimistically
|
|
56
|
+
try {
|
|
57
|
+
this.git(workspacePath, `push origin HEAD:${targetBranch}`);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
if (retryCount >= this.maxRetries) {
|
|
61
|
+
return {
|
|
62
|
+
status: "conflict",
|
|
63
|
+
retryCount,
|
|
64
|
+
error: `Push rejected after ${retryCount + 1} attempts`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
retryCount++;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const commitHash = this.git(workspacePath, "rev-parse HEAD").trim();
|
|
71
|
+
// Emit validation:requested event (RD5 — judge handles validation)
|
|
72
|
+
if (this.eventStore) {
|
|
73
|
+
try {
|
|
74
|
+
this.eventStore.emit({
|
|
75
|
+
type: "status",
|
|
76
|
+
source: { agent_id: request.agentId },
|
|
77
|
+
payload: {
|
|
78
|
+
status_type: "checkpoint",
|
|
79
|
+
summary: `Validation requested for ${commitHash.slice(0, 8)}`,
|
|
80
|
+
validation_requested: true,
|
|
81
|
+
commitHash,
|
|
82
|
+
sourceBranch: request.sourceBranch,
|
|
83
|
+
targetBranch,
|
|
84
|
+
taskId: request.taskId,
|
|
85
|
+
agentId: request.agentId,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// Never fail land() due to event emission failure
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
status: "landed",
|
|
95
|
+
commitHash,
|
|
96
|
+
retryCount,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return {
|
|
101
|
+
status: "failed",
|
|
102
|
+
retryCount,
|
|
103
|
+
error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
status: "failed",
|
|
109
|
+
retryCount,
|
|
110
|
+
error: "Exceeded maximum retries",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
git(cwd, args) {
|
|
114
|
+
return execSync(`git ${args}`, {
|
|
115
|
+
cwd,
|
|
116
|
+
encoding: "utf-8",
|
|
117
|
+
timeout: 30000,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=optimistic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimistic.js","sourceRoot":"","sources":["../../../src/workspace/strategies/optimistic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AASzC,MAAM,OAAO,6BAA6B;IAC/B,IAAI,GAAG,YAAY,CAAC;IACrB,UAAU,CAAS;IACnB,UAAU,CAAc;IAEhC,YAAY,MAAgC;QAC1C,MAAM,WAAW,GAAG,MAA8C,CAAC;QACnE,IAAI,CAAC,UAAU,GAAG,WAAW,EAAE,UAAU,IAAI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nC,OAAO,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE;YAC7B,GAAG;YACH,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue Integration Strategy
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing MergeQueueInterface — submits merge requests to
|
|
5
|
+
* the queue for sequential processing by an integrator agent.
|
|
6
|
+
*
|
|
7
|
+
* This produces identical behavior to the current worker done() handler's
|
|
8
|
+
* merge queue path.
|
|
9
|
+
*
|
|
10
|
+
* @module workspace/strategies/queue
|
|
11
|
+
*/
|
|
12
|
+
import type { IntegrationStrategy, LandRequest, LandResult } from "./types.js";
|
|
13
|
+
import type { MergeQueueInterface } from "../merge-queue/types.js";
|
|
14
|
+
export declare class QueueIntegrationStrategy implements IntegrationStrategy {
|
|
15
|
+
readonly name = "queue";
|
|
16
|
+
private mergeQueue?;
|
|
17
|
+
private defaultPriority;
|
|
18
|
+
constructor(config?: Record<string, unknown>);
|
|
19
|
+
/**
|
|
20
|
+
* Set the merge queue instance.
|
|
21
|
+
* Called after construction since merge queue may not be available at strategy creation time.
|
|
22
|
+
*/
|
|
23
|
+
setMergeQueue(queue: MergeQueueInterface): void;
|
|
24
|
+
land(request: LandRequest): Promise<LandResult>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/workspace/strategies/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,UAAU,EAEX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE,qBAAa,wBAAyB,YAAW,mBAAmB;IAClE,QAAQ,CAAC,IAAI,WAAW;IACxB,OAAO,CAAC,UAAU,CAAC,CAAsB;IACzC,OAAO,CAAC,eAAe,CAAS;gBAEpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAK5C;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAIzC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;CA0CtD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue Integration Strategy
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing MergeQueueInterface — submits merge requests to
|
|
5
|
+
* the queue for sequential processing by an integrator agent.
|
|
6
|
+
*
|
|
7
|
+
* This produces identical behavior to the current worker done() handler's
|
|
8
|
+
* merge queue path.
|
|
9
|
+
*
|
|
10
|
+
* @module workspace/strategies/queue
|
|
11
|
+
*/
|
|
12
|
+
export class QueueIntegrationStrategy {
|
|
13
|
+
name = "queue";
|
|
14
|
+
mergeQueue;
|
|
15
|
+
defaultPriority;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
const typedConfig = config;
|
|
18
|
+
this.defaultPriority = typedConfig?.defaultPriority ?? 100;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set the merge queue instance.
|
|
22
|
+
* Called after construction since merge queue may not be available at strategy creation time.
|
|
23
|
+
*/
|
|
24
|
+
setMergeQueue(queue) {
|
|
25
|
+
this.mergeQueue = queue;
|
|
26
|
+
}
|
|
27
|
+
async land(request) {
|
|
28
|
+
if (!this.mergeQueue) {
|
|
29
|
+
return {
|
|
30
|
+
status: "failed",
|
|
31
|
+
error: "Merge queue not configured",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (!request.streamId) {
|
|
35
|
+
return {
|
|
36
|
+
status: "failed",
|
|
37
|
+
error: "streamId required for queue strategy",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (!request.taskId) {
|
|
41
|
+
return {
|
|
42
|
+
status: "failed",
|
|
43
|
+
error: "taskId required for queue strategy",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const mrId = this.mergeQueue.submit({
|
|
48
|
+
streamId: request.streamId,
|
|
49
|
+
taskId: request.taskId,
|
|
50
|
+
workerBranch: request.sourceBranch,
|
|
51
|
+
workerAgentId: request.agentId,
|
|
52
|
+
priority: this.defaultPriority,
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
status: "landed",
|
|
56
|
+
mergeRequestId: mrId,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
return {
|
|
61
|
+
status: "failed",
|
|
62
|
+
error: `Failed to submit to merge queue: ${error instanceof Error ? error.message : String(error)}`,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../src/workspace/strategies/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,MAAM,OAAO,wBAAwB;IAC1B,IAAI,GAAG,OAAO,CAAC;IAChB,UAAU,CAAuB;IACjC,eAAe,CAAS;IAEhC,YAAY,MAAgC;QAC1C,MAAM,WAAW,GAAG,MAAyC,CAAC;QAC9D,IAAI,CAAC,eAAe,GAAG,WAAW,EAAE,eAAe,IAAI,GAAG,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,KAA0B;QACtC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,4BAA4B;aACpC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACtB,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,sCAAsC;aAC9C,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,oCAAoC;aAC5C,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;gBAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,aAAa,EAAE,OAAO,CAAC,OAAO;gBAC9B,QAAQ,EAAE,IAAI,CAAC,eAAe;aAC/B,CAAC,CAAC;YAEH,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,cAAc,EAAE,IAAI;aACrB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,oCAAoC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;aACpG,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Strategy Registry
|
|
3
|
+
*
|
|
4
|
+
* Factory registry for creating named integration strategies.
|
|
5
|
+
* Supports registration of custom strategies alongside built-in ones.
|
|
6
|
+
*
|
|
7
|
+
* @module workspace/strategies/registry
|
|
8
|
+
*/
|
|
9
|
+
import type { IntegrationStrategy, IntegrationStrategyFactory } from "./types.js";
|
|
10
|
+
export declare class IntegrationStrategyRegistry {
|
|
11
|
+
private factories;
|
|
12
|
+
/**
|
|
13
|
+
* Register a strategy factory under a name.
|
|
14
|
+
*/
|
|
15
|
+
register(name: string, factory: IntegrationStrategyFactory): void;
|
|
16
|
+
/**
|
|
17
|
+
* Create a strategy instance by name.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error if the strategy name is not registered
|
|
20
|
+
*/
|
|
21
|
+
get(name: string, config?: Record<string, unknown>): IntegrationStrategy;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a strategy is registered.
|
|
24
|
+
*/
|
|
25
|
+
has(name: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* List registered strategy names.
|
|
28
|
+
*/
|
|
29
|
+
list(): string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a registry with all built-in strategies registered.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createDefaultStrategyRegistry(): IntegrationStrategyRegistry;
|
|
35
|
+
/** Singleton default registry */
|
|
36
|
+
export declare const defaultStrategyRegistry: IntegrationStrategyRegistry;
|
|
37
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/workspace/strategies/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AASpB,qBAAa,2BAA2B;IACtC,OAAO,CAAC,SAAS,CAAiD;IAElE;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAIjE;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,mBAAmB;IAUxE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;CAGjB;AAMD;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,2BAA2B,CAiB3E;AAED,iCAAiC;AACjC,eAAO,MAAM,uBAAuB,6BAAkC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Strategy Registry
|
|
3
|
+
*
|
|
4
|
+
* Factory registry for creating named integration strategies.
|
|
5
|
+
* Supports registration of custom strategies alongside built-in ones.
|
|
6
|
+
*
|
|
7
|
+
* @module workspace/strategies/registry
|
|
8
|
+
*/
|
|
9
|
+
import { QueueIntegrationStrategy } from "./queue.js";
|
|
10
|
+
import { TrunkIntegrationStrategy } from "./trunk.js";
|
|
11
|
+
import { OptimisticIntegrationStrategy } from "./optimistic.js";
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Registry
|
|
14
|
+
// =============================================================================
|
|
15
|
+
export class IntegrationStrategyRegistry {
|
|
16
|
+
factories = new Map();
|
|
17
|
+
/**
|
|
18
|
+
* Register a strategy factory under a name.
|
|
19
|
+
*/
|
|
20
|
+
register(name, factory) {
|
|
21
|
+
this.factories.set(name, factory);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a strategy instance by name.
|
|
25
|
+
*
|
|
26
|
+
* @throws Error if the strategy name is not registered
|
|
27
|
+
*/
|
|
28
|
+
get(name, config) {
|
|
29
|
+
const factory = this.factories.get(name);
|
|
30
|
+
if (!factory) {
|
|
31
|
+
throw new Error(`Unknown integration strategy: '${name}'. Available: ${this.list().join(", ")}`);
|
|
32
|
+
}
|
|
33
|
+
return factory(config);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if a strategy is registered.
|
|
37
|
+
*/
|
|
38
|
+
has(name) {
|
|
39
|
+
return this.factories.has(name);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* List registered strategy names.
|
|
43
|
+
*/
|
|
44
|
+
list() {
|
|
45
|
+
return Array.from(this.factories.keys());
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// =============================================================================
|
|
49
|
+
// Default Registry
|
|
50
|
+
// =============================================================================
|
|
51
|
+
/**
|
|
52
|
+
* Create a registry with all built-in strategies registered.
|
|
53
|
+
*/
|
|
54
|
+
export function createDefaultStrategyRegistry() {
|
|
55
|
+
const registry = new IntegrationStrategyRegistry();
|
|
56
|
+
registry.register("queue", (config) => new QueueIntegrationStrategy(config));
|
|
57
|
+
registry.register("trunk", (config) => new TrunkIntegrationStrategy(config));
|
|
58
|
+
registry.register("optimistic", (config) => new OptimisticIntegrationStrategy(config));
|
|
59
|
+
return registry;
|
|
60
|
+
}
|
|
61
|
+
/** Singleton default registry */
|
|
62
|
+
export const defaultStrategyRegistry = createDefaultStrategyRegistry();
|
|
63
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/workspace/strategies/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAEhE,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,MAAM,OAAO,2BAA2B;IAC9B,SAAS,GAAG,IAAI,GAAG,EAAsC,CAAC;IAElE;;OAEG;IACH,QAAQ,CAAC,IAAY,EAAE,OAAmC;QACxD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,IAAY,EAAE,MAAgC;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACb,kCAAkC,IAAI,iBAAiB,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChF,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,6BAA6B;IAC3C,MAAM,QAAQ,GAAG,IAAI,2BAA2B,EAAE,CAAC;IAEnD,QAAQ,CAAC,QAAQ,CACf,OAAO,EACP,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,CACjD,CAAC;IACF,QAAQ,CAAC,QAAQ,CACf,OAAO,EACP,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,MAAM,CAAC,CACjD,CAAC;IACF,QAAQ,CAAC,QAAQ,CACf,YAAY,EACZ,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,6BAA6B,CAAC,MAAM,CAAC,CACtD,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,iCAAiC;AACjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,6BAA6B,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trunk Integration Strategy
|
|
3
|
+
*
|
|
4
|
+
* Direct push to integration branch with rebase-and-retry on conflict.
|
|
5
|
+
* Suited for trunk-based development workflows where changes are
|
|
6
|
+
* integrated immediately.
|
|
7
|
+
*
|
|
8
|
+
* @module workspace/strategies/trunk
|
|
9
|
+
*/
|
|
10
|
+
import type { IntegrationStrategy, LandRequest, LandResult } from "./types.js";
|
|
11
|
+
export declare class TrunkIntegrationStrategy implements IntegrationStrategy {
|
|
12
|
+
readonly name = "trunk";
|
|
13
|
+
private maxRetries;
|
|
14
|
+
private conflictAction;
|
|
15
|
+
constructor(config?: Record<string, unknown>);
|
|
16
|
+
land(request: LandRequest): Promise<LandResult>;
|
|
17
|
+
private git;
|
|
18
|
+
private getConflictFiles;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=trunk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trunk.d.ts","sourceRoot":"","sources":["../../../src/workspace/strategies/trunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,UAAU,EAEX,MAAM,YAAY,CAAC;AAEpB,qBAAa,wBAAyB,YAAW,mBAAmB;IAClE,QAAQ,CAAC,IAAI,WAAW;IACxB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAsC;gBAEhD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMtC,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA6ErD,OAAO,CAAC,GAAG;IAQX,OAAO,CAAC,gBAAgB;CAQzB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trunk Integration Strategy
|
|
3
|
+
*
|
|
4
|
+
* Direct push to integration branch with rebase-and-retry on conflict.
|
|
5
|
+
* Suited for trunk-based development workflows where changes are
|
|
6
|
+
* integrated immediately.
|
|
7
|
+
*
|
|
8
|
+
* @module workspace/strategies/trunk
|
|
9
|
+
*/
|
|
10
|
+
import { execSync } from "child_process";
|
|
11
|
+
export class TrunkIntegrationStrategy {
|
|
12
|
+
name = "trunk";
|
|
13
|
+
maxRetries;
|
|
14
|
+
conflictAction;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
const typedConfig = config;
|
|
17
|
+
this.maxRetries = typedConfig?.maxRetries ?? 3;
|
|
18
|
+
this.conflictAction = typedConfig?.conflictAction ?? "abandon";
|
|
19
|
+
}
|
|
20
|
+
async land(request) {
|
|
21
|
+
const { workspacePath, targetBranch } = request;
|
|
22
|
+
let retryCount = 0;
|
|
23
|
+
while (retryCount <= this.maxRetries) {
|
|
24
|
+
try {
|
|
25
|
+
// Fetch latest target branch
|
|
26
|
+
this.git(workspacePath, `fetch origin ${targetBranch}`);
|
|
27
|
+
// Rebase our changes onto latest target
|
|
28
|
+
try {
|
|
29
|
+
this.git(workspacePath, `rebase origin/${targetBranch}`);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Rebase conflict — abort and retry or give up
|
|
33
|
+
try {
|
|
34
|
+
this.git(workspacePath, "rebase --abort");
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
/* already clean */
|
|
38
|
+
}
|
|
39
|
+
if (retryCount >= this.maxRetries) {
|
|
40
|
+
const conflictFiles = this.getConflictFiles(workspacePath);
|
|
41
|
+
return {
|
|
42
|
+
status: "conflict",
|
|
43
|
+
conflictFiles,
|
|
44
|
+
action: this.conflictAction === "abandon" ? "abandoned" : this.conflictAction,
|
|
45
|
+
retryCount,
|
|
46
|
+
error: `Rebase conflict after ${retryCount + 1} attempts`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
retryCount++;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// Push to target branch
|
|
53
|
+
try {
|
|
54
|
+
this.git(workspacePath, `push origin HEAD:${targetBranch}`);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Push rejected (concurrent update) — retry
|
|
58
|
+
if (retryCount >= this.maxRetries) {
|
|
59
|
+
return {
|
|
60
|
+
status: "conflict",
|
|
61
|
+
action: this.conflictAction === "abandon" ? "abandoned" : this.conflictAction,
|
|
62
|
+
retryCount,
|
|
63
|
+
error: `Push rejected after ${retryCount + 1} attempts`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
retryCount++;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
// Get the HEAD commit hash
|
|
70
|
+
const commitHash = this.git(workspacePath, "rev-parse HEAD").trim();
|
|
71
|
+
return {
|
|
72
|
+
status: "landed",
|
|
73
|
+
commitHash,
|
|
74
|
+
retryCount,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
status: "failed",
|
|
80
|
+
retryCount,
|
|
81
|
+
error: `Unexpected error: ${error instanceof Error ? error.message : String(error)}`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
status: "failed",
|
|
87
|
+
retryCount,
|
|
88
|
+
error: "Exceeded maximum retries",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
git(cwd, args) {
|
|
92
|
+
return execSync(`git ${args}`, {
|
|
93
|
+
cwd,
|
|
94
|
+
encoding: "utf-8",
|
|
95
|
+
timeout: 30000,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
getConflictFiles(cwd) {
|
|
99
|
+
try {
|
|
100
|
+
const output = this.git(cwd, "diff --name-only --diff-filter=U");
|
|
101
|
+
return output.split("\n").filter(Boolean);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=trunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trunk.js","sourceRoot":"","sources":["../../../src/workspace/strategies/trunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,MAAM,OAAO,wBAAwB;IAC1B,IAAI,GAAG,OAAO,CAAC;IAChB,UAAU,CAAS;IACnB,cA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EO,gBAAgB,CAAC,GAAW;QAClC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,kCAAkC,CAAC,CAAC;YACjE,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Strategy Types
|
|
3
|
+
*
|
|
4
|
+
* Defines the pluggable strategy interface for integrating worker changes
|
|
5
|
+
* into the integration branch. Strategies determine how completed work
|
|
6
|
+
* is landed (merge queue, direct push, optimistic push).
|
|
7
|
+
*
|
|
8
|
+
* @module workspace/strategies/types
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Result status from a land operation
|
|
12
|
+
*/
|
|
13
|
+
export type LandResultStatus = "landed" | "conflict" | "failed";
|
|
14
|
+
/**
|
|
15
|
+
* Request to land changes from a worker branch
|
|
16
|
+
*/
|
|
17
|
+
export interface LandRequest {
|
|
18
|
+
/** Worker's branch with completed changes */
|
|
19
|
+
sourceBranch: string;
|
|
20
|
+
/** Target integration branch */
|
|
21
|
+
targetBranch: string;
|
|
22
|
+
/** Workspace path where git operations run */
|
|
23
|
+
workspacePath: string;
|
|
24
|
+
/** Agent ID of the worker */
|
|
25
|
+
agentId: string;
|
|
26
|
+
/** Task ID associated with the changes */
|
|
27
|
+
taskId?: string;
|
|
28
|
+
/** Stream ID for the integration stream */
|
|
29
|
+
streamId?: string;
|
|
30
|
+
/** Commit message for the merge/rebase */
|
|
31
|
+
commitMessage?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Result of a land operation
|
|
35
|
+
*/
|
|
36
|
+
export interface LandResult {
|
|
37
|
+
/** Whether the landing was successful */
|
|
38
|
+
status: LandResultStatus;
|
|
39
|
+
/** Merge/rebase commit hash if landed */
|
|
40
|
+
commitHash?: string;
|
|
41
|
+
/** Merge request ID if submitted to a queue */
|
|
42
|
+
mergeRequestId?: string;
|
|
43
|
+
/** Files with conflicts if status is "conflict" */
|
|
44
|
+
conflictFiles?: string[];
|
|
45
|
+
/** Action taken on conflict exhaustion */
|
|
46
|
+
action?: "abandoned" | "queued_for_resolution";
|
|
47
|
+
/** Error message if status is "failed" */
|
|
48
|
+
error?: string;
|
|
49
|
+
/** Number of retry attempts made */
|
|
50
|
+
retryCount?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Integration strategy interface.
|
|
54
|
+
*
|
|
55
|
+
* Strategies determine how completed worker changes are integrated
|
|
56
|
+
* into the target branch. Different strategies suit different workflows:
|
|
57
|
+
* - queue: Sequential merge via integrator (default, existing behavior)
|
|
58
|
+
* - trunk: Direct push with rebase-and-retry
|
|
59
|
+
* - optimistic: Push immediately, validate later (judge validates)
|
|
60
|
+
*/
|
|
61
|
+
export interface IntegrationStrategy {
|
|
62
|
+
/** Strategy name */
|
|
63
|
+
readonly name: string;
|
|
64
|
+
/**
|
|
65
|
+
* Land changes from source branch to target branch.
|
|
66
|
+
*/
|
|
67
|
+
land(request: LandRequest): Promise<LandResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Optional initialization hook (called on TeamRuntime.initialize()).
|
|
70
|
+
*/
|
|
71
|
+
initialize?(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Optional cleanup hook (called on TeamRuntime.teardown()).
|
|
74
|
+
*/
|
|
75
|
+
close?(): Promise<void>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Configuration for the queue strategy
|
|
79
|
+
*/
|
|
80
|
+
export interface QueueStrategyConfig {
|
|
81
|
+
/** Priority for submitted merge requests (default: 100) */
|
|
82
|
+
defaultPriority?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Configuration for the trunk strategy
|
|
86
|
+
*/
|
|
87
|
+
export interface TrunkStrategyConfig {
|
|
88
|
+
/** Maximum rebase-and-retry attempts on conflict (default: 3) */
|
|
89
|
+
maxRetries?: number;
|
|
90
|
+
/** Action on conflict exhaustion (default: "abandon") */
|
|
91
|
+
conflictAction?: "abandon" | "queued_for_resolution";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for the optimistic strategy
|
|
95
|
+
*/
|
|
96
|
+
export interface OptimisticStrategyConfig {
|
|
97
|
+
/** Maximum rebase-and-retry attempts on conflict (default: 3) */
|
|
98
|
+
maxRetries?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Factory function signature for creating strategies
|
|
102
|
+
*/
|
|
103
|
+
export type IntegrationStrategyFactory = (config?: Record<string, unknown>) => IntegrationStrategy;
|
|
104
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workspace/strategies/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,YAAY,EAAE,MAAM,CAAC;IAErB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IAErB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IAEtB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAEhB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,MAAM,EAAE,gBAAgB,CAAC;IAEzB,yCAAyC;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pluggable strategy interface for integrating worker changes
|
|
5
|
+
* into the integration branch. Strategies determine how completed work
|
|
6
|
+
* is landed (merge queue, direct push, optimistic push).
|
|
7
|
+
*
|
|
8
|
+
* @module workspace/strategies/types
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|