@open-multi-agent/core 1.4.2 → 1.6.0

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.
Files changed (131) hide show
  1. package/README.md +135 -79
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/agent.js +5 -0
  4. package/dist/agent/agent.js.map +1 -1
  5. package/dist/agent/runner.d.ts +12 -0
  6. package/dist/agent/runner.d.ts.map +1 -1
  7. package/dist/agent/runner.js +48 -12
  8. package/dist/agent/runner.js.map +1 -1
  9. package/dist/cli/oma.d.ts +10 -2
  10. package/dist/cli/oma.d.ts.map +1 -1
  11. package/dist/cli/oma.js +12 -5
  12. package/dist/cli/oma.js.map +1 -1
  13. package/dist/dashboard/render-team-run-dashboard.d.ts.map +1 -1
  14. package/dist/dashboard/render-team-run-dashboard.js +177 -84
  15. package/dist/dashboard/render-team-run-dashboard.js.map +1 -1
  16. package/dist/errors.d.ts +10 -0
  17. package/dist/errors.d.ts.map +1 -1
  18. package/dist/errors.js +13 -0
  19. package/dist/errors.js.map +1 -1
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/llm/adapter.d.ts +5 -1
  25. package/dist/llm/adapter.d.ts.map +1 -1
  26. package/dist/llm/adapter.js +16 -0
  27. package/dist/llm/adapter.js.map +1 -1
  28. package/dist/llm/ai-sdk.d.ts +2 -1
  29. package/dist/llm/ai-sdk.d.ts.map +1 -1
  30. package/dist/llm/ai-sdk.js +48 -13
  31. package/dist/llm/ai-sdk.js.map +1 -1
  32. package/dist/llm/anthropic.d.ts.map +1 -1
  33. package/dist/llm/anthropic.js +27 -13
  34. package/dist/llm/anthropic.js.map +1 -1
  35. package/dist/llm/azure-openai.d.ts.map +1 -1
  36. package/dist/llm/azure-openai.js +5 -2
  37. package/dist/llm/azure-openai.js.map +1 -1
  38. package/dist/llm/bedrock.d.ts.map +1 -1
  39. package/dist/llm/bedrock.js +32 -19
  40. package/dist/llm/bedrock.js.map +1 -1
  41. package/dist/llm/copilot.d.ts.map +1 -1
  42. package/dist/llm/copilot.js +5 -2
  43. package/dist/llm/copilot.js.map +1 -1
  44. package/dist/llm/deepseek.d.ts +9 -2
  45. package/dist/llm/deepseek.d.ts.map +1 -1
  46. package/dist/llm/deepseek.js +21 -2
  47. package/dist/llm/deepseek.js.map +1 -1
  48. package/dist/llm/doubao.d.ts +21 -0
  49. package/dist/llm/doubao.d.ts.map +1 -0
  50. package/dist/llm/doubao.js +24 -0
  51. package/dist/llm/doubao.js.map +1 -0
  52. package/dist/llm/gemini.d.ts.map +1 -1
  53. package/dist/llm/gemini.js +35 -18
  54. package/dist/llm/gemini.js.map +1 -1
  55. package/dist/llm/hunyuan.d.ts +40 -0
  56. package/dist/llm/hunyuan.d.ts.map +1 -0
  57. package/dist/llm/hunyuan.js +59 -0
  58. package/dist/llm/hunyuan.js.map +1 -0
  59. package/dist/llm/mimo.d.ts +24 -0
  60. package/dist/llm/mimo.d.ts.map +1 -0
  61. package/dist/llm/mimo.js +30 -0
  62. package/dist/llm/mimo.js.map +1 -0
  63. package/dist/llm/openai-common.d.ts +10 -17
  64. package/dist/llm/openai-common.d.ts.map +1 -1
  65. package/dist/llm/openai-common.js +92 -43
  66. package/dist/llm/openai-common.js.map +1 -1
  67. package/dist/llm/openai.d.ts +22 -1
  68. package/dist/llm/openai.d.ts.map +1 -1
  69. package/dist/llm/openai.js +51 -7
  70. package/dist/llm/openai.js.map +1 -1
  71. package/dist/llm/reasoning-fallback.d.ts +80 -15
  72. package/dist/llm/reasoning-fallback.d.ts.map +1 -1
  73. package/dist/llm/reasoning-fallback.js +45 -12
  74. package/dist/llm/reasoning-fallback.js.map +1 -1
  75. package/dist/llm/validate.d.ts +26 -0
  76. package/dist/llm/validate.d.ts.map +1 -0
  77. package/dist/llm/validate.js +55 -0
  78. package/dist/llm/validate.js.map +1 -0
  79. package/dist/memory/shared.d.ts +14 -7
  80. package/dist/memory/shared.d.ts.map +1 -1
  81. package/dist/memory/shared.js +97 -14
  82. package/dist/memory/shared.js.map +1 -1
  83. package/dist/orchestrator/orchestrator.d.ts +22 -1
  84. package/dist/orchestrator/orchestrator.d.ts.map +1 -1
  85. package/dist/orchestrator/orchestrator.js +155 -32
  86. package/dist/orchestrator/orchestrator.js.map +1 -1
  87. package/dist/tool/built-in/bash.d.ts +1 -1
  88. package/dist/tool/built-in/bash.d.ts.map +1 -1
  89. package/dist/tool/built-in/bash.js +60 -7
  90. package/dist/tool/built-in/bash.js.map +1 -1
  91. package/dist/tool/built-in/file-edit.d.ts.map +1 -1
  92. package/dist/tool/built-in/file-edit.js +13 -8
  93. package/dist/tool/built-in/file-edit.js.map +1 -1
  94. package/dist/tool/built-in/file-read.d.ts.map +1 -1
  95. package/dist/tool/built-in/file-read.js +9 -4
  96. package/dist/tool/built-in/file-read.js.map +1 -1
  97. package/dist/tool/built-in/file-write.d.ts.map +1 -1
  98. package/dist/tool/built-in/file-write.js +11 -6
  99. package/dist/tool/built-in/file-write.js.map +1 -1
  100. package/dist/tool/built-in/fs-walk.d.ts.map +1 -1
  101. package/dist/tool/built-in/fs-walk.js +6 -3
  102. package/dist/tool/built-in/fs-walk.js.map +1 -1
  103. package/dist/tool/built-in/glob.d.ts.map +1 -1
  104. package/dist/tool/built-in/glob.js +10 -4
  105. package/dist/tool/built-in/glob.js.map +1 -1
  106. package/dist/tool/built-in/grep.d.ts.map +1 -1
  107. package/dist/tool/built-in/grep.js +15 -6
  108. package/dist/tool/built-in/grep.js.map +1 -1
  109. package/dist/tool/built-in/path-safety.d.ts +30 -0
  110. package/dist/tool/built-in/path-safety.d.ts.map +1 -0
  111. package/dist/tool/built-in/path-safety.js +106 -0
  112. package/dist/tool/built-in/path-safety.js.map +1 -0
  113. package/dist/tool/mcp.d.ts.map +1 -1
  114. package/dist/tool/mcp.js +58 -33
  115. package/dist/tool/mcp.js.map +1 -1
  116. package/dist/types.d.ts +151 -5
  117. package/dist/types.d.ts.map +1 -1
  118. package/dist/utils/redaction.d.ts +4 -0
  119. package/dist/utils/redaction.d.ts.map +1 -0
  120. package/dist/utils/redaction.js +78 -0
  121. package/dist/utils/redaction.js.map +1 -0
  122. package/package.json +7 -4
  123. package/docs/DECISIONS.md +0 -49
  124. package/docs/cli.md +0 -265
  125. package/docs/context-management.md +0 -64
  126. package/docs/featured-partner.md +0 -28
  127. package/docs/observability.md +0 -56
  128. package/docs/providers/minimax.md +0 -75
  129. package/docs/providers.md +0 -80
  130. package/docs/shared-memory.md +0 -27
  131. package/docs/tool-configuration.md +0 -152
package/docs/providers.md DELETED
@@ -1,80 +0,0 @@
1
- # Providers
2
-
3
- `open-multi-agent` keeps the agent config shape stable across hosted, cloud, and local providers. Change `provider`, `model`, and the relevant credential; the rest of your team definition stays the same.
4
-
5
- ```typescript
6
- const agent = {
7
- name: 'my-agent',
8
- provider: 'anthropic',
9
- model: 'claude-sonnet-4-6',
10
- systemPrompt: 'You are a helpful assistant.',
11
- }
12
- ```
13
-
14
- ## Built-In Provider Shortcuts
15
-
16
- The framework ships a wired-in provider name for each of these. Set `provider` and the env var, and the adapter handles the endpoint.
17
-
18
- > Under the hood, Anthropic, Gemini, and Bedrock use provider-specific APIs. The other built-in shortcuts are pre-configured wrappers around OpenAI-compatible endpoints; same wire format as the OpenAI-compatible table below, with the `baseURL` already supplied.
19
-
20
- | Provider | Config | Env var | Example model | Notes |
21
- |----------|--------|---------|---------------|-------|
22
- | Anthropic (Claude) | `provider: 'anthropic'` | `ANTHROPIC_API_KEY` | `claude-sonnet-4-6` | Native Anthropic SDK. |
23
- | Gemini | `provider: 'gemini'` | `GEMINI_API_KEY` | `gemini-2.5-pro` | Native Google GenAI SDK. Requires `npm install @google/genai`. |
24
- | OpenAI (GPT) | `provider: 'openai'` | `OPENAI_API_KEY` | `gpt-4o` | |
25
- | Azure OpenAI | `provider: 'azure-openai'` | `AZURE_OPENAI_API_KEY`, `AZURE_OPENAI_ENDPOINT` | `gpt-4` | Optional `AZURE_OPENAI_API_VERSION`, `AZURE_OPENAI_DEPLOYMENT`. |
26
- | GitHub Copilot | `provider: 'copilot'` | `GITHUB_COPILOT_TOKEN` (falls back to `GITHUB_TOKEN`) | `gpt-4o` | Custom token-exchange flow on top of OpenAI protocol. |
27
- | Grok (xAI) | `provider: 'grok'` | `XAI_API_KEY` | `grok-4` | OpenAI-compatible; endpoint is `api.x.ai/v1`. |
28
- | DeepSeek | `provider: 'deepseek'` | `DEEPSEEK_API_KEY` | `deepseek-chat` | OpenAI-compatible. `deepseek-chat` (V3, coding) or `deepseek-reasoner` (thinking mode). |
29
- | MiniMax (global) | `provider: 'minimax'` | `MINIMAX_API_KEY` | `MiniMax-M2.7` | OpenAI-compatible. |
30
- | MiniMax (China) | `provider: 'minimax'` + `MINIMAX_BASE_URL` | `MINIMAX_API_KEY` | `MiniMax-M2.7` | Set `MINIMAX_BASE_URL=https://api.minimaxi.com/v1`. |
31
- | Qiniu | `provider: 'qiniu'` | `QINIU_API_KEY` | `deepseek-v3` | OpenAI-compatible. Endpoint `https://api.qnaigc.com/v1`; multiple model families, see [Qiniu AI docs](https://developer.qiniu.com/aitokenapi/12882/ai-inference-api). |
32
- | AWS Bedrock | `provider: 'bedrock'` | none (AWS SDK credential chain) | `anthropic.claude-3-5-haiku-20241022-v1:0` | No API key. Set `AWS_REGION` or pass `region` as the 4th arg to `createAdapter`. Credentials come from env vars, shared config, or IAM role. Newer Claude models can require a cross-region inference profile prefix such as `us.`. Also supports Llama, Mistral, and Cohere. See [`providers/bedrock`](../examples/providers/bedrock.ts). Requires `npm install @aws-sdk/client-bedrock-runtime`. |
33
-
34
- ## OpenAI-Compatible Providers
35
-
36
- No bundled shortcut is needed when a server speaks OpenAI Chat Completions. Use `provider: 'openai'` and point `baseURL` at the service.
37
-
38
- | Service | Config | Env var | Example model | Notes |
39
- |---------|--------|---------|---------------|-------|
40
- | Ollama (local) | `provider: 'openai'` + `baseURL: 'http://localhost:11434/v1'` | none | `llama3.1` | |
41
- | vLLM (local) | `provider: 'openai'` + `baseURL` | none | server-loaded | |
42
- | LM Studio (local) | `provider: 'openai'` + `baseURL` | none | server-loaded | |
43
- | llama.cpp server (local) | `provider: 'openai'` + `baseURL` | none | server-loaded | |
44
- | OpenRouter | `provider: 'openai'` + `baseURL: 'https://openrouter.ai/api/v1'` + `apiKey` | `OPENROUTER_API_KEY` | `openai/gpt-4o-mini` | |
45
- | Groq | `provider: 'openai'` + `baseURL: 'https://api.groq.com/openai/v1'` | `GROQ_API_KEY` | `llama-3.3-70b-versatile` | |
46
- | Mistral | `provider: 'openai'` + `baseURL: 'https://api.mistral.ai/v1'` | `MISTRAL_API_KEY` | `mistral-large-latest` | See [`providers/mistral`](../examples/providers/mistral.ts). |
47
- | Zhipu GLM | `provider: 'openai'` + `baseURL: 'https://open.bigmodel.cn/api/paas/v4'` | `ZHIPU_API_KEY` | `glm-4-plus` | See [`providers/zhipu`](../examples/providers/zhipu.ts). |
48
- | Doubao (ByteDance) | `provider: 'openai'` + `baseURL: 'https://ark.cn-beijing.volces.com/api/v3'` | `ARK_API_KEY` | `doubao-1-5-pro-32k-250115` | See [`providers/doubao`](../examples/providers/doubao.ts). |
49
-
50
- Other services can be connected the same way if they implement the OpenAI Chat Completions API, but they are not listed as verified providers here. For services where the key is not `OPENAI_API_KEY`, pass it explicitly via `apiKey`; otherwise the `openai` adapter falls back to `OPENAI_API_KEY`.
51
-
52
- ## Local Model Tool-Calling
53
-
54
- The framework supports tool-calling with local models served by Ollama, vLLM, LM Studio, or llama.cpp. Tool-calling is handled natively through the OpenAI-compatible API.
55
-
56
- Verified local models include Gemma 4, Llama 3.1, Qwen 3, Mistral, and Phi-4. Ollama publishes its tool-capable models at [ollama.com/search?c=tools](https://ollama.com/search?c=tools).
57
-
58
- If a local model returns tool calls as text instead of the `tool_calls` wire format, the framework automatically extracts them from the text output. This helps with thinking models or misconfigured local servers.
59
-
60
- Use `timeoutMs` on `AgentConfig` for slow local inference:
61
-
62
- ```typescript
63
- const localAgent = {
64
- name: 'local',
65
- model: 'llama3.1',
66
- provider: 'openai',
67
- baseURL: 'http://localhost:11434/v1',
68
- apiKey: 'ollama',
69
- tools: ['bash', 'file_read'],
70
- timeoutMs: 120_000,
71
- }
72
- ```
73
-
74
- Highly quantized MoE models on consumer hardware can fall into repetition loops or hallucinate tool-call schemas under default sampling. `AgentConfig` exposes `topK`, `minP`, `frequencyPenalty`, `presencePenalty`, `parallelToolCalls`, and `extraBody` for server-specific knobs such as vLLM's `repetition_penalty`. See [`providers/local-quantized`](../examples/providers/local-quantized.ts) for a complete setup.
75
-
76
- ## Troubleshooting
77
-
78
- - Model not calling tools? Confirm it appears in Ollama's [Tools category](https://ollama.com/search?c=tools).
79
- - Using Ollama? Update to the latest version with `ollama update`.
80
- - Proxy interfering with local servers? Use `no_proxy=localhost`.
@@ -1,27 +0,0 @@
1
- # Shared Memory
2
-
3
- Teams can share a namespaced key-value store so later agents see earlier agents' findings. Enable it with a boolean for the default in-process store:
4
-
5
- ```typescript
6
- const team = orchestrator.createTeam('research-team', {
7
- name: 'research-team',
8
- agents: [researcher, writer],
9
- sharedMemory: true,
10
- })
11
- ```
12
-
13
- For durable or cross-process backends (Redis, Postgres, Engram, etc.), implement the `MemoryStore` interface and pass it via `sharedMemoryStore`. Keys are still namespaced as `<agentName>/<key>` before reaching the store:
14
-
15
- ```typescript
16
- import type { MemoryStore } from '@open-multi-agent/core'
17
-
18
- class RedisStore implements MemoryStore { /* get/set/list/delete/clear */ }
19
-
20
- const team = orchestrator.createTeam('durable-team', {
21
- name: 'durable-team',
22
- agents: [researcher, writer],
23
- sharedMemoryStore: new RedisStore(),
24
- })
25
- ```
26
-
27
- When both are provided, `sharedMemoryStore` wins. SDK-only: the CLI cannot pass runtime objects.
@@ -1,152 +0,0 @@
1
- # Tool Configuration
2
-
3
- Agents can be configured with fine-grained tool access control using presets, allowlists, and denylists.
4
-
5
- ## Tool Presets
6
-
7
- Predefined tool sets for common use cases:
8
-
9
- ```typescript
10
- const readonlyAgent: AgentConfig = {
11
- name: 'reader',
12
- model: 'claude-sonnet-4-6',
13
- toolPreset: 'readonly', // file_read, grep, glob
14
- }
15
-
16
- const readwriteAgent: AgentConfig = {
17
- name: 'editor',
18
- model: 'claude-sonnet-4-6',
19
- toolPreset: 'readwrite', // file_read, file_write, file_edit, grep, glob
20
- }
21
-
22
- const fullAgent: AgentConfig = {
23
- name: 'executor',
24
- model: 'claude-sonnet-4-6',
25
- toolPreset: 'full', // file_read, file_write, file_edit, grep, glob, bash
26
- }
27
- ```
28
-
29
- ## Advanced Filtering
30
-
31
- Combine presets with allowlists and denylists for precise control:
32
-
33
- ```typescript
34
- const customAgent: AgentConfig = {
35
- name: 'custom',
36
- model: 'claude-sonnet-4-6',
37
- toolPreset: 'readwrite', // Start with: file_read, file_write, file_edit, grep, glob
38
- tools: ['file_read', 'grep'], // Allowlist: intersect with preset = file_read, grep
39
- disallowedTools: ['grep'], // Denylist: subtract = file_read only
40
- }
41
- ```
42
-
43
- **Resolution order:** preset → allowlist → denylist → framework safety rails.
44
-
45
- ## Custom Tools
46
-
47
- Two ways to give an agent a tool that is not in the built-in set.
48
-
49
- **Inject at config time** via `customTools` on `AgentConfig`. Good when the orchestrator wires up tools centrally. Tools defined here bypass preset/allowlist filtering but still respect `disallowedTools`.
50
-
51
- ```typescript
52
- import { defineTool } from '@open-multi-agent/core'
53
- import { z } from 'zod'
54
-
55
- const weatherTool = defineTool({
56
- name: 'get_weather',
57
- description: 'Look up current weather for a city.',
58
- inputSchema: z.object({ city: z.string() }),
59
- execute: async ({ city }) => ({ data: await fetchWeather(city) }),
60
- })
61
-
62
- const agent: AgentConfig = {
63
- name: 'assistant',
64
- model: 'claude-sonnet-4-6',
65
- customTools: [weatherTool],
66
- }
67
- ```
68
-
69
- **Register at runtime** via `agent.addTool(tool)`. Tools added this way are always available, regardless of filtering.
70
-
71
- ## Tool Output Control
72
-
73
- Long tool outputs can blow up conversation size and cost. Two controls work together.
74
-
75
- **Validation (optional).** Add `outputSchema` to catch malformed tool results before they are forwarded:
76
-
77
- > **Note — two different `outputSchema` fields.** The one on `defineTool()` /
78
- > `ToolDefinition` (shown below) validates a single **tool's** `ToolResult.data`
79
- > — it is always a `ZodSchema<string>` because tool output is serialised as
80
- > text. The `outputSchema` on [`AgentConfig`](../examples/patterns/structured-output.ts)
81
- > is different: it validates the **agent's final answer** as parsed JSON
82
- > against an arbitrary Zod schema (see _Structured output_ in `examples/`).
83
- > Different types, different scopes — TypeScript won't warn you if you mix
84
- > them up, so pick the one that matches the layer you're working at.
85
-
86
- ```typescript
87
- const jsonTool = defineTool({
88
- name: 'json_tool',
89
- description: 'Return JSON payload as string.',
90
- inputSchema: z.object({}),
91
- outputSchema: z.string().refine((value) => {
92
- try {
93
- JSON.parse(value)
94
- return true
95
- } catch {
96
- return false
97
- }
98
- }, 'Output must be valid JSON'),
99
- execute: async () => ({ data: '{"ok": true}' }),
100
- })
101
- ```
102
-
103
- **Truncation.** Cap an individual tool result to a head + tail excerpt with a marker in between:
104
-
105
- ```typescript
106
- const agent: AgentConfig = {
107
- // ...
108
- maxToolOutputChars: 10_000, // applies to every tool this agent runs
109
- }
110
-
111
- // Per-tool override (takes priority over AgentConfig.maxToolOutputChars):
112
- const bigQueryTool = defineTool({
113
- // ...
114
- maxOutputChars: 50_000,
115
- })
116
- ```
117
-
118
- **Post-consumption compression.** Once the agent has acted on a tool result, compress older copies in the transcript so they stop costing input tokens on every subsequent turn. Error results are never compressed.
119
-
120
- ```typescript
121
- const agent: AgentConfig = {
122
- // ...
123
- compressToolResults: true, // default threshold: 500 chars
124
- // or: compressToolResults: { minChars: 2_000 }
125
- }
126
- ```
127
-
128
- ## MCP Tools (Model Context Protocol)
129
-
130
- `open-multi-agent` can connect to stdio MCP servers and expose their tools directly to agents.
131
-
132
- ```typescript
133
- import { connectMCPTools } from '@open-multi-agent/core/mcp'
134
-
135
- const { tools, disconnect } = await connectMCPTools({
136
- command: 'npx',
137
- args: ['-y', '@modelcontextprotocol/server-github'],
138
- env: { GITHUB_TOKEN: process.env.GITHUB_TOKEN },
139
- namePrefix: 'github',
140
- })
141
-
142
- // Register each MCP tool in your ToolRegistry, then include their names in AgentConfig.tools
143
- // Don't forget cleanup when done
144
- await disconnect()
145
- ```
146
-
147
- Notes:
148
- - `@modelcontextprotocol/sdk` is an optional peer dependency, only needed when using MCP.
149
- - Current transport support is stdio.
150
- - MCP input validation is delegated to the MCP server (`inputSchema` is `z.any()`).
151
-
152
- See [`integrations/mcp-github`](../examples/integrations/mcp-github.ts) for a full runnable setup.