agency-orchestrator 0.6.3 → 0.6.5
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/dist/cli/compose.js +10 -4
- package/dist/cli/demo.js +2 -1
- package/dist/connectors/ollama.js +28 -15
- package/dist/core/executor.js +2 -1
- package/dist/mcp/server.js +2 -2
- package/package.json +1 -1
package/dist/cli/compose.js
CHANGED
|
@@ -66,6 +66,9 @@ function buildComposeSystemPromptEn(catalog, options) {
|
|
|
66
66
|
const autoRun = options?.autoRun ?? false;
|
|
67
67
|
const provider = options?.provider || 'deepseek';
|
|
68
68
|
const model = options?.model;
|
|
69
|
+
const isLocal = provider === 'ollama';
|
|
70
|
+
const maxTokens = isLocal ? 8192 : 4096;
|
|
71
|
+
const timeoutMs = isLocal ? 600000 : 120000;
|
|
69
72
|
const inputsSection = autoRun
|
|
70
73
|
? `
|
|
71
74
|
## Important: Direct Run Mode
|
|
@@ -109,8 +112,8 @@ agents_dir: "agency-agents"
|
|
|
109
112
|
llm:
|
|
110
113
|
provider: ${provider}
|
|
111
114
|
${model ? `model: ${model}` : ''}
|
|
112
|
-
max_tokens:
|
|
113
|
-
timeout:
|
|
115
|
+
max_tokens: ${maxTokens}
|
|
116
|
+
timeout: ${timeoutMs}
|
|
114
117
|
retry: 2
|
|
115
118
|
|
|
116
119
|
concurrency: 2
|
|
@@ -155,6 +158,9 @@ function buildComposeSystemPromptZh(catalog, options) {
|
|
|
155
158
|
const autoRun = options?.autoRun ?? false;
|
|
156
159
|
const provider = options?.provider || 'deepseek';
|
|
157
160
|
const model = options?.model;
|
|
161
|
+
const isLocal = provider === 'ollama';
|
|
162
|
+
const maxTokens = isLocal ? 8192 : 4096;
|
|
163
|
+
const timeoutMs = isLocal ? 600000 : 120000;
|
|
158
164
|
const inputsSection = autoRun
|
|
159
165
|
? `
|
|
160
166
|
## 重要:直接运行模式
|
|
@@ -198,8 +204,8 @@ agents_dir: "agency-agents-zh"
|
|
|
198
204
|
llm:
|
|
199
205
|
provider: ${provider}
|
|
200
206
|
${model ? `model: ${model}` : ''}
|
|
201
|
-
max_tokens:
|
|
202
|
-
timeout:
|
|
207
|
+
max_tokens: ${maxTokens}
|
|
208
|
+
timeout: ${timeoutMs}
|
|
203
209
|
retry: 2
|
|
204
210
|
|
|
205
211
|
concurrency: 2
|
package/dist/cli/demo.js
CHANGED
|
@@ -151,7 +151,8 @@ export async function detectAvailableLLMs() {
|
|
|
151
151
|
try {
|
|
152
152
|
const controller = new AbortController();
|
|
153
153
|
const timeout = setTimeout(() => controller.abort(), 2000);
|
|
154
|
-
const
|
|
154
|
+
const ollamaUrl = process.env.OLLAMA_BASE_URL || 'http://localhost:11434';
|
|
155
|
+
const res = await fetch(`${ollamaUrl.replace(/\/+$/, '')}/api/tags`, {
|
|
155
156
|
signal: controller.signal,
|
|
156
157
|
});
|
|
157
158
|
clearTimeout(timeout);
|
|
@@ -5,23 +5,36 @@ export class OllamaConnector {
|
|
|
5
5
|
this.baseUrl = raw.replace(/\/+$/, '');
|
|
6
6
|
}
|
|
7
7
|
async chat(systemPrompt, userMessage, config) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
let response;
|
|
9
|
+
try {
|
|
10
|
+
response = await fetch(`${this.baseUrl}/api/chat`, {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: { 'Content-Type': 'application/json' },
|
|
13
|
+
body: JSON.stringify({
|
|
14
|
+
model: config.model || 'llama3.1',
|
|
15
|
+
messages: [
|
|
16
|
+
{ role: 'system', content: systemPrompt },
|
|
17
|
+
{ role: 'user', content: userMessage },
|
|
18
|
+
],
|
|
19
|
+
stream: false,
|
|
20
|
+
options: {
|
|
21
|
+
num_predict: config.max_tokens || 8192,
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
if (err?.cause?.code === 'ECONNREFUSED' || err?.message?.includes('ECONNREFUSED')) {
|
|
28
|
+
throw new Error(`无法连接 Ollama (${this.baseUrl}),请确认 ollama 已启动。Docker 环境请设置 OLLAMA_BASE_URL=http://host.docker.internal:11434`);
|
|
29
|
+
}
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
23
32
|
if (!response.ok) {
|
|
24
33
|
const text = await response.text();
|
|
34
|
+
if (response.status === 404 && text.includes('not found')) {
|
|
35
|
+
const model = config.model || 'llama3.1';
|
|
36
|
+
throw new Error(`Ollama 模型 "${model}" 未找到,请先运行: ollama pull ${model}`);
|
|
37
|
+
}
|
|
25
38
|
throw new Error(`Ollama error ${response.status}: ${text}`);
|
|
26
39
|
}
|
|
27
40
|
const data = await response.json();
|
package/dist/core/executor.js
CHANGED
|
@@ -10,7 +10,8 @@ export async function executeDAG(dag, options) {
|
|
|
10
10
|
const startTime = Date.now();
|
|
11
11
|
const stepResults = [];
|
|
12
12
|
const isCLI = llmConfig.provider.endsWith('-cli') || llmConfig.provider === 'claude-code';
|
|
13
|
-
const
|
|
13
|
+
const isLocal = llmConfig.provider === 'ollama';
|
|
14
|
+
const timeout = llmConfig.timeout || (isCLI ? 600_000 : isLocal ? 600_000 : 120_000);
|
|
14
15
|
const maxRetry = llmConfig.retry ?? 5;
|
|
15
16
|
// CLI provider 强制串行:共享同一账户额度,并发会触发限速反而更慢
|
|
16
17
|
const effectiveConcurrency = isCLI ? 1 : concurrency;
|
package/dist/mcp/server.js
CHANGED
|
@@ -232,14 +232,14 @@ export async function startServer(verbose = false) {
|
|
|
232
232
|
}, async ({ description, provider, model }) => {
|
|
233
233
|
try {
|
|
234
234
|
const agentsDir = findAgentsDir();
|
|
235
|
-
const llmProvider = provider || 'deepseek';
|
|
235
|
+
const llmProvider = provider || process.env.AO_PROVIDER || 'deepseek';
|
|
236
236
|
const defaultModels = {
|
|
237
237
|
deepseek: 'deepseek-chat',
|
|
238
238
|
claude: 'claude-sonnet-4-20250514',
|
|
239
239
|
openai: 'gpt-4o',
|
|
240
240
|
ollama: 'llama3',
|
|
241
241
|
};
|
|
242
|
-
const llmModel = model || defaultModels[llmProvider] || 'gpt-4o';
|
|
242
|
+
const llmModel = model || process.env.AO_MODEL || defaultModels[llmProvider] || 'gpt-4o';
|
|
243
243
|
const result = await silentCall(() => composeWorkflow({
|
|
244
244
|
description,
|
|
245
245
|
agentsDir,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agency-orchestrator",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Multi-agent YAML workflow engine — 211 AI roles, auto DAG parallelism, zero code. One sentence → multiple AI roles collaborate → complete plan in minutes. 10 LLM providers, 7 need no API key.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multi-agent",
|