@donmai/core

中文文档
0.10.0发布于 2026/10/28MITTypeScriptES Module构建来源已验证近 30 天下载 1.9万

编码代理人——管弦器、提供商、事故恢复的多代理机队管理

中文使用文档
文档目录8 节
  1. 安装
  2. 快速启动
  3. 它会做什么
  4. 提供者摘要
  5. 配置
  6. 工作流程 州长
  7. 相关软件包
  8. 许可证

@ 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)}`)
}

它会做什么

  1. 问题选择 ——查询积压问题的线性,按项目过滤,优先选择
  2. 创建工作树 · 每名特工建立孤立的一棵工作树
  3. 代理产卵 ——出席提供者(克洛德,Codex,Amp)的代表
  4. 流程处理 - 时间 AgentEvent 从提供者向线性发送活动
  5. 崩溃恢复 - 持续状态 .agent/ 目录,重新启动时恢复
  6. 不活动超时 监视闲置的特工并阻止他们

提供者摘要

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 服务器

许可证

麻省理工学院

版本与发布记录

@donmai/core 共发布 18 个版本,首次发布于 2026/05/25;过去 12 个月发布了 18 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.10.0latest2026/10/2816 天前
0.9.152026/09/122 个月前
0.9.142026/08/252 个月前
0.9.132026/08/232 个月前
0.9.122026/08/232 个月前
0.9.112026/08/142 个月前

关于 @donmai/core 的常见问题

@donmai/core 是什么?

编码代理人——管弦器、提供商、事故恢复的多代理机队管理

如何安装 @donmai/core?

在项目目录运行 npm install @donmai/core,或使用 pnpm add / yarn add / bun add。

@donmai/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@donmai/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@donmai/core 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.23.4。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@donmai/core 可以商用吗?

@donmai/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@donmai/core 的下载量有多少?

根据 npm 官方下载统计,@donmai/core 在 2026/10/13 – 2026/11/11 这 30 天内被下载 19,463 次,日均约 649 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@donmai/core 还在维护吗?

最新版本 0.10.0 发布于 2026/10/28(16 天前);至今共发布 18 个版本,其中过去 12 个月发布了 18 个;首次发布于 2026/05/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。