diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f3e284..52f8469 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,3 +37,33 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage/lcov.info fail_ci_if_error: false + + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run build + - name: Assert the npm tarball ships exactly the expected files + run: | + paths=$(npm pack --dry-run --json | jq -r '.[0].files[].path') + unexpected=$(echo "$paths" | grep -vE '^(dist/|README\.md$|LICENSE$|package\.json$)' || true) + if [ -n "$unexpected" ]; then + echo "Unexpected files staged for the npm tarball:" + echo "$unexpected" + echo "Only dist/, README.md, LICENSE, package.json may ship." + exit 1 + fi + missing="" + for f in dist/index.js dist/index.d.ts dist/cli/oma.js dist/mcp.js dist/mcp.d.ts dist/ai-sdk.js dist/ai-sdk.d.ts; do + echo "$paths" | grep -qxF "$f" || missing="$missing $f" + done + if [ -n "$missing" ]; then + echo "Required entry points missing from the npm tarball:$missing" + echo "Either the build did not run or an entry was dropped from package.json \"files\"." + exit 1 + fi diff --git a/README.md b/README.md index 6e87efc..d5de6f5 100644 --- a/README.md +++ b/README.md @@ -133,18 +133,18 @@ const plan = await orchestrator.runTeam(team, goal, { planOnly: true }) | Capability | What you get | |------------|--------------| | **Goal-driven coordinator** | One `runTeam(team, goal)` call decomposes the goal into a task DAG, parallelizes independents, and synthesizes the result. Unassigned tasks are auto-scheduled — `dependency-first` (default), `round-robin`, `least-busy`, or `capability-match`. | -| **Mix providers in one team** | 12 built-in providers plus any OpenAI-compatible endpoint (Ollama, vLLM, LM Studio, OpenRouter, Groq), mixed freely in one team. Local servers that emit tool calls as plain text are recovered by a fallback parser. ([full list](#supported-providers) · [setup](./docs/providers.md)) | +| **Mix providers in one team** | 12 built-in providers plus any OpenAI-compatible endpoint (Ollama, vLLM, LM Studio, OpenRouter, Groq), mixed freely in one team. Local servers that emit tool calls as plain text are recovered by a fallback parser. ([full list](#supported-providers) · [setup](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers.md)) | | **Extended thinking / reasoning** | One `thinking` config maps to Anthropic thinking, Gemini `thinkingConfig`, and OpenAI `reasoning_effort`; reasoning is streamed as events, with opt-in preservation across a provider switch. ([`cross-provider-reasoning`](examples/patterns/cross-provider-reasoning.ts)) | -| **Tools + MCP** | 6 built-in (`bash`, `file_*`, `grep`, `glob`), opt-in `delegate_to_agent` (cycle + depth guards), custom tools via `defineTool()` + Zod, stdio MCP servers via `connectMCPTools()`. ([tool config](./docs/tool-configuration.md)) | +| **Tools + MCP** | 6 built-in (`bash`, `file_*`, `grep`, `glob`), opt-in `delegate_to_agent` (cycle + depth guards), custom tools via `defineTool()` + Zod, stdio MCP servers via `connectMCPTools()`. ([tool config](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/tool-configuration.md)) | | **Streaming + structured output** | Token-by-token streaming on every adapter (per-agent during team runs via `onAgentStream`); Zod-validated final answer with auto-retry on parse failure. ([`structured-output`](examples/patterns/structured-output.ts)) | | **Human-in-the-loop** | Gate execution with `onPlanReady` (approve the plan before any agent runs) and `onApproval` (approve between task rounds), or inspect first with `planOnly`. | | **Lifecycle hooks + cancellation** | `beforeRun` rewrites the prompt, `afterRun` post-processes or rejects the result; pass an `AbortSignal` to cancel a run in flight. | | **Configurable coordinator** | Override the coordinator's model, provider, adapter, system prompt, or tools via `runTeam(team, goal, { coordinator })`. | -| **Observability** | `onProgress` events, `onTrace` spans, post-run HTML dashboard rendering the executed task DAG. API keys and tokens are redacted from traces, bash output, and the dashboard. ([observability guide](./docs/observability.md)) | -| **Pluggable shared memory** | Default in-process KV; swap in Redis / Postgres / your own backend by implementing `MemoryStore`. ([shared memory](./docs/shared-memory.md)) | -| **Sandboxed filesystem workspace** | Built-in filesystem tools are sandboxed to `/.agent-workspace` by default; agents sharing the default configuration share this root. For per-agent isolation, set `AgentConfig.cwd`; for a different shared root, set `OrchestratorConfig.defaultCwd`; pass `null` to disable. ([sandbox config](./docs/tool-configuration.md)) | +| **Observability** | `onProgress` events, `onTrace` spans, post-run HTML dashboard rendering the executed task DAG. API keys and tokens are redacted from traces, bash output, and the dashboard. ([observability guide](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/observability.md)) | +| **Pluggable shared memory** | Default in-process KV; swap in Redis / Postgres / your own backend by implementing `MemoryStore`. ([shared memory](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/shared-memory.md)) | +| **Sandboxed filesystem workspace** | Built-in filesystem tools are sandboxed to `/.agent-workspace` by default; agents sharing the default configuration share this root. For per-agent isolation, set `AgentConfig.cwd`; for a different shared root, set `OrchestratorConfig.defaultCwd`; pass `null` to disable. ([sandbox config](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/tool-configuration.md)) | -Production controls ([context strategies](./docs/context-management.md), task retry with backoff, loop detection, tool output truncation/compression) are covered in the [Production Checklist](#production-checklist). +Production controls ([context strategies](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/context-management.md), task retry with backoff, loop detection, tool output truncation/compression) are covered in the [Production Checklist](#production-checklist). ## Orchestration Controls @@ -183,7 +183,7 @@ await orchestrator.runTeam(team, goal, { **Fan-out without dependencies.** For MapReduce-style parallelism, use `AgentPool.runParallel()` directly. See [`patterns/fan-out-aggregate`](examples/patterns/fan-out-aggregate.ts). -**Shell & CI.** Use the JSON-first `oma` binary. See [docs/cli.md](./docs/cli.md). +**Shell & CI.** Use the JSON-first `oma` binary. See [docs/cli.md](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/cli.md). ## Examples @@ -257,11 +257,11 @@ Built an integration? See the [integration guide](examples/integrations/README.m Limited-time provider offers for `open-multi-agent` users. Listings are not paid endorsements. -- **[MiniMax](https://platform.minimax.io/subscribe/coding-plan?code=6ZoOY13DDV&source=link)** — Use MiniMax M2.7 in OMA's TypeScript multi-agent workflows. OMA users get 12% off the MiniMax Token Plan until 2026-06-30. See the [MiniMax setup guide](./docs/providers/minimax.md). +- **[MiniMax](https://platform.minimax.io/subscribe/coding-plan?code=6ZoOY13DDV&source=link)** — Use MiniMax M2.7 in OMA's TypeScript multi-agent workflows. OMA users get 12% off the MiniMax Token Plan until 2026-06-30. See the [MiniMax setup guide](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers/minimax.md). ### Featured partner -For products and platforms with a deep `open-multi-agent` integration. See the [Featured partner program](./docs/featured-partner.md) for terms and how to apply. +For products and platforms with a deep `open-multi-agent` integration. See the [Featured partner program](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/featured-partner.md) for terms and how to apply. ## Architecture @@ -325,7 +325,7 @@ const agent: AgentConfig = { | OpenAI-compatible endpoints | Set `provider: 'openai'` plus `baseURL` and, when needed, `apiKey`. | Ollama, vLLM, LM Studio, llama.cpp server, OpenRouter, Groq, Mistral, Moonshot (Kimi), Qwen, Zhipu | | Vercel AI SDK | Import `AISdkAdapter` from `@open-multi-agent/core/ai-sdk`; install optional peer `ai` plus an `@ai-sdk/*` provider. | [Any AI SDK provider](https://ai-sdk.dev/providers) (60+ models and hosts) | -See [docs/providers.md](./docs/providers.md) for env vars, model examples, local tool-calling, timeouts, and troubleshooting. +See [docs/providers.md](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers.md) for env vars, model examples, local tool-calling, timeouts, and troubleshooting. ### Vercel AI SDK (optional) @@ -368,12 +368,12 @@ Before going live, wire up the controls that protect token spend, recover from f ## Documentation -- [Providers](./docs/providers.md) — env vars, model examples, local tool-calling, timeouts, troubleshooting. -- [Tool configuration](./docs/tool-configuration.md) — tool presets, custom tools, the filesystem sandbox, and MCP. -- [Observability](./docs/observability.md) — `onProgress` events, `onTrace` spans, and the post-run dashboard. -- [Shared memory](./docs/shared-memory.md) — the default store and custom `MemoryStore` backends. -- [Context management](./docs/context-management.md) — sliding window, summarization, compaction, and custom compressors. -- [CLI](./docs/cli.md) — the JSON-first `oma` binary for shell and CI. +- [Providers](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers.md) — env vars, model examples, local tool-calling, timeouts, troubleshooting. +- [Tool configuration](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/tool-configuration.md) — tool presets, custom tools, the filesystem sandbox, and MCP. +- [Observability](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/observability.md) — `onProgress` events, `onTrace` spans, and the post-run dashboard. +- [Shared memory](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/shared-memory.md) — the default store and custom `MemoryStore` backends. +- [Context management](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/context-management.md) — sliding window, summarization, compaction, and custom compressors. +- [CLI](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/cli.md) — the JSON-first `oma` binary for shell and CI. ## Contributing diff --git a/README_zh.md b/README_zh.md index 4a655ab..f09c2f2 100644 --- a/README_zh.md +++ b/README_zh.md @@ -133,18 +133,18 @@ const plan = await orchestrator.runTeam(team, goal, { planOnly: true }) | 能力 | 说明 | |------|------| | **目标驱动协调者** | 一个 `runTeam(team, goal)` 调用,把目标拆成任务 DAG,并行执行独立任务,合成最终结果。未分配的任务自动调度——`dependency-first`(默认)、`round-robin`、`least-busy` 或 `capability-match`。 | -| **同队混用 provider** | 12 家内置 provider,外加任意 OpenAI 兼容端点(Ollama、vLLM、LM Studio、OpenRouter、Groq),同队可自由混用。把 tool call 当纯文本输出的本地 server 会由 fallback 解析器兜底。([完整清单](#支持的-provider) · [配置](./docs/providers.md)) | +| **同队混用 provider** | 12 家内置 provider,外加任意 OpenAI 兼容端点(Ollama、vLLM、LM Studio、OpenRouter、Groq),同队可自由混用。把 tool call 当纯文本输出的本地 server 会由 fallback 解析器兜底。([完整清单](#支持的-provider) · [配置](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers.md)) | | **扩展思考 / 推理** | 一份 `thinking` 配置映射到 Anthropic thinking、Gemini `thinkingConfig` 和 OpenAI `reasoning_effort`;推理以事件流式输出,并可选在切换 provider 时保留。([`cross-provider-reasoning`](examples/patterns/cross-provider-reasoning.ts)) | -| **工具 + MCP** | 6 个内置(`bash`、`file_*`、`grep`、`glob`),可选启用 `delegate_to_agent`(带 cycle + depth 护栏),用 `defineTool()` + Zod 自定义,任意 MCP server 通过 `connectMCPTools()` 接入。([工具配置](./docs/tool-configuration.md)) | +| **工具 + MCP** | 6 个内置(`bash`、`file_*`、`grep`、`glob`),可选启用 `delegate_to_agent`(带 cycle + depth 护栏),用 `defineTool()` + Zod 自定义,任意 MCP server 通过 `connectMCPTools()` 接入。([工具配置](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/tool-configuration.md)) | | **流式 + 结构化输出** | 每个 adapter 都支持 token 级流式输出(团队运行时通过 `onAgentStream` 拿到每个 agent 的流);用 Zod schema 校验最终答复,解析失败自动重试。([`structured-output`](examples/patterns/structured-output.ts)) | | **人工介入(Human-in-the-loop)** | 用 `onPlanReady`(任何 agent 执行前审批整个计划)和 `onApproval`(每轮任务之间审批)卡点,或用 `planOnly` 先预览。 | | **生命周期钩子 + 取消** | `beforeRun` 改写 prompt,`afterRun` 后处理或拒绝结果;传入 `AbortSignal` 即可中途取消运行。 | | **可配置协调者** | 通过 `runTeam(team, goal, { coordinator })` 覆盖协调者的 model、provider、adapter、system prompt 或工具。 | -| **可观测性** | `onProgress` 事件、`onTrace` span,运行结束后渲染任务 DAG 的 HTML dashboard。API key 和 token 会从 trace、bash 输出和 dashboard 中自动脱敏。([可观测性指南](./docs/observability.md)) | -| **可插拔共享记忆** | 默认进程内 KV;实现 `MemoryStore` 接口即可换 Redis / Postgres / 自家后端。([共享记忆](./docs/shared-memory.md)) | -| **沙箱化文件系统工作目录** | 内置文件系统工具默认沙箱化在 `/.agent-workspace`;继承默认配置的 agent 共享同一根目录。需要 per-agent 隔离时显式设置 `AgentConfig.cwd`;改换共享根目录用 `OrchestratorConfig.defaultCwd`;传 `null` 关闭沙箱。([沙箱配置](./docs/tool-configuration.md)) | +| **可观测性** | `onProgress` 事件、`onTrace` span,运行结束后渲染任务 DAG 的 HTML dashboard。API key 和 token 会从 trace、bash 输出和 dashboard 中自动脱敏。([可观测性指南](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/observability.md)) | +| **可插拔共享记忆** | 默认进程内 KV;实现 `MemoryStore` 接口即可换 Redis / Postgres / 自家后端。([共享记忆](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/shared-memory.md)) | +| **沙箱化文件系统工作目录** | 内置文件系统工具默认沙箱化在 `/.agent-workspace`;继承默认配置的 agent 共享同一根目录。需要 per-agent 隔离时显式设置 `AgentConfig.cwd`;改换共享根目录用 `OrchestratorConfig.defaultCwd`;传 `null` 关闭沙箱。([沙箱配置](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/tool-configuration.md)) | -生产级控制([上下文策略](./docs/context-management.md)、任务重试退避、循环检测、工具输出截断/压缩)见 [生产级检查清单](#生产级检查清单)。 +生产级控制([上下文策略](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/context-management.md)、任务重试退避、循环检测、工具输出截断/压缩)见 [生产级检查清单](#生产级检查清单)。 ## 编排控制 @@ -183,7 +183,7 @@ await orchestrator.runTeam(team, goal, { **无依赖 fan-out。** 要 MapReduce 风格的并行,直接用 `AgentPool.runParallel()`。见 [`patterns/fan-out-aggregate`](examples/patterns/fan-out-aggregate.ts)。 -**Shell 和 CI。** 使用 JSON-first 的 `oma` 命令行工具。详见 [docs/cli.md](./docs/cli.md)。 +**Shell 和 CI。** 使用 JSON-first 的 `oma` 命令行工具。详见 [docs/cli.md](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/cli.md)。 ## 示例 @@ -257,11 +257,11 @@ await orchestrator.runTeam(team, goal, { 面向 `open-multi-agent` 用户的限时 provider 优惠。该列表不代表付费背书或唯一官方推荐。 -- **[MiniMax](https://platform.minimaxi.com/subscribe/token-plan?code=98qruMqQhL&source=link)** — 在 OMA 的 TypeScript 多智能体工作流中使用 MiniMax M2.7。OMA 用户可在 2026-06-30 前享 MiniMax Token Plan 专属 88 折优惠。见 [MiniMax 接入指南](./docs/providers/minimax.md)。 +- **[MiniMax](https://platform.minimaxi.com/subscribe/token-plan?code=98qruMqQhL&source=link)** — 在 OMA 的 TypeScript 多智能体工作流中使用 MiniMax M2.7。OMA 用户可在 2026-06-30 前享 MiniMax Token Plan 专属 88 折优惠。见 [MiniMax 接入指南](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers/minimax.md)。 ### Featured partner -面向已经深度集成 `open-multi-agent` 的产品和平台。条款和申请方式见 [Featured partner 计划](./docs/featured-partner.md)。 +面向已经深度集成 `open-multi-agent` 的产品和平台。条款和申请方式见 [Featured partner 计划](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/featured-partner.md)。 ## 架构 @@ -325,7 +325,7 @@ const agent: AgentConfig = { | OpenAI 兼容端点 | 设 `provider: 'openai'` + `baseURL`,必要时加 `apiKey`。 | Ollama、vLLM、LM Studio、llama.cpp server、OpenRouter、Groq、Mistral、Moonshot(Kimi)、Qwen、Zhipu(智谱) | | Vercel AI SDK | 从 `@open-multi-agent/core/ai-sdk` 导入 `AISdkAdapter`;安装可选 peer `ai` 加一个 `@ai-sdk/*` provider。 | [任意 AI SDK provider](https://ai-sdk.dev/providers)(60+ 模型与平台) | -详见 [docs/providers.md](./docs/providers.md),含环境变量、模型示例、本地模型工具调用、超时设置、常见问题。 +详见 [docs/providers.md](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers.md),含环境变量、模型示例、本地模型工具调用、超时设置、常见问题。 ### Vercel AI SDK(可选) @@ -368,12 +368,12 @@ await oma.runAgent( ## 文档 -- [Provider](./docs/providers.md) — 环境变量、模型示例、本地模型工具调用、超时、常见问题。 -- [工具配置](./docs/tool-configuration.md) — 工具预设、自定义工具、文件系统沙箱、MCP。 -- [可观测性](./docs/observability.md) — `onProgress` 事件、`onTrace` span、运行后 dashboard。 -- [共享记忆](./docs/shared-memory.md) — 默认存储与自定义 `MemoryStore` 后端。 -- [上下文管理](./docs/context-management.md) — 滑动窗口、摘要、压缩、自定义压缩器。 -- [CLI](./docs/cli.md) — 面向 shell 和 CI 的 JSON-first `oma` 命令行。 +- [Provider](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/providers.md) — 环境变量、模型示例、本地模型工具调用、超时、常见问题。 +- [工具配置](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/tool-configuration.md) — 工具预设、自定义工具、文件系统沙箱、MCP。 +- [可观测性](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/observability.md) — `onProgress` 事件、`onTrace` span、运行后 dashboard。 +- [共享记忆](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/shared-memory.md) — 默认存储与自定义 `MemoryStore` 后端。 +- [上下文管理](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/context-management.md) — 滑动窗口、摘要、压缩、自定义压缩器。 +- [CLI](https://github.com/open-multi-agent/open-multi-agent/blob/main/docs/cli.md) — 面向 shell 和 CI 的 JSON-first `oma` 命令行。 ## 参与贡献 diff --git a/package-lock.json b/package-lock.json index 78e989c..a636090 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@open-multi-agent/core", - "version": "1.4.2", + "version": "1.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@open-multi-agent/core", - "version": "1.4.2", + "version": "1.5.0", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.52.0", diff --git a/package.json b/package.json index 3317dbd..12d30b1 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,9 @@ { "name": "@open-multi-agent/core", - "version": "1.4.2", + "version": "1.5.0", "description": "TypeScript multi-agent framework — one runTeam() call from goal to result. Auto task decomposition, parallel execution. 3 dependencies, deploys anywhere Node.js runs.", "files": [ "dist", - "docs", "README.md", "LICENSE" ],