@ donmai/ core (韩语)
多代理机队管理的核心管弦乐手. 通过自动管道协调编码代理(Claude, Codex, Amp),将您的问题积压变成运出代码.
部分 东迈 单相机.
安装
npm install @donmai/core @donmai/plugin-linear
快速启动
import { createOrchestrator } from '@donmai/core'
const orchestrator = createOrchestrator({
maxConcurrent: 3,
// Default: '../{repoName}.wt/' (sibling directory)
})
// Process a single issue
await orchestrator.spawnAgentForIssue('PROJ-123')
await orchestrator.waitForAll()
// Check results
for (const agent of orchestrator.getAgents()) {
console.log(`${agent.identifier}: ${agent.status}`)
if (agent.pullRequestUrl) console.log(` PR: ${agent.pullRequestUrl}`)
if (agent.totalCostUsd) console.log(` Cost: $${agent.totalCostUsd.toFixed(4)}`)
}
它会做什么
- 问题选择 ——查询积压问题的线性,按项目过滤,优先选择
- 创建工作树 · 每名特工建立孤立的一棵工作树
- 代理产卵 ——出席提供者(克洛德,Codex,Amp)的代表
- 流程处理 - 时间
AgentEvent从提供者向线性发送活动 - 崩溃恢复 - 持续状态
.agent/目录,重新启动时恢复 - 不活动超时 监视闲置的特工并阻止他们
提供者摘要
interface AgentProvider {
readonly name: 'claude' | 'codex' | 'amp'
spawn(config: AgentSpawnConfig): AgentHandle
resume(sessionId: string, config: AgentSpawnConfig): AgentHandle
}
interface AgentHandle {
sessionId: string | null
stream: AsyncIterable<AgentEvent>
injectMessage(text: string): Promise<void>
stop(): Promise<void>
}
提供者分辨率 : AGENT_PROVIDER_{WORKTYPE} > 翻译: AGENT_PROVIDER_{PROJECT} > 翻译: AGENT_PROVIDER > 翻译: 'claude'
配置
const orchestrator = createOrchestrator({
provider: myProvider, // Agent provider instance
maxConcurrent: 3, // Max concurrent agents
project: 'MyProject', // Filter by project
// worktreePath defaults to '../{repoName}.wt/' (sibling directory)
inactivityTimeoutMs: 300_000, // 5 min idle timeout
maxSessionTimeoutMs: 7_200_000, // 2 hour hard cap
workTypeTimeouts: {
qa: { inactivityTimeoutMs: 600_000 },
},
})
工作流程 州长
核心一揽子计划包括Workflow Governor——一个观察所有问题的中央生命周期管理者,并决定派遣什么工作.
import {
WorkflowGovernor,
EventDrivenGovernor,
InMemoryEventBus,
InMemoryEventDeduplicator,
type GovernorDependencies,
} from '@donmai/core'
// Poll-only mode (simple)
const governor = new WorkflowGovernor(
{ projects: ['MyProject'], scanIntervalMs: 60_000 },
myDependencies,
)
governor.start()
// Event-driven mode (production)
const eventGovernor = new EventDrivenGovernor(
{
projects: ['MyProject'],
eventBus: new InMemoryEventBus(), // or RedisEventBus
deduplicator: new InMemoryEventDeduplicator(), // or RedisEventDeduplicator
pollIntervalMs: 300_000, // 5 min safety net
},
myDependencies,
)
await eventGovernor.start()
州长根据状况、活动会话、冷却、人性凌驾(HOLD/RESUME/PRIORITY)和工作流程战略对每个问题进行评估,以决定应采取的行动。 见 建筑文件 详细情况.
相关软件包
| 软件包 | 说明 |
|---|---|
| @donmai/plugin-线性 | 线性问题跟踪器集成 |
| @ donmai/ 服务器 | 重复工作排队,分布式工人 |
| @donmai/ cli (英语) | CLI 工具 |
| @donmai/ nextjs (英语) | Next.js Webhook 服务器 |
许可证
麻省理工学院