jinzd-ai-cli 0.4.35 → 0.4.36
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/{chunk-GSPLUO3M.js → chunk-2WCIKGEH.js} +15 -47
- package/dist/{chunk-PTNODLIV.js → chunk-3G3R4NFG.js} +1 -1
- package/dist/{chunk-B4FJ7JTH.js → chunk-7E7OF7CV.js} +1 -1
- package/dist/{chunk-NHANECAS.js → chunk-NCPGLZIQ.js} +1 -1
- package/dist/{hub-IUMZBNBH.js → hub-EEZCFZHN.js} +1 -1
- package/dist/index.js +6 -6
- package/dist/{run-tests-IND26J25.js → run-tests-2PI4DIQM.js} +1 -1
- package/dist/{run-tests-UGPKOQ6J.js → run-tests-XGACYH3X.js} +1 -1
- package/dist/{server-VPTEWZD4.js → server-HDJXB7RH.js} +4 -4
- package/dist/{task-orchestrator-GPTGIDZ5.js → task-orchestrator-6AVTEKH4.js} +2 -2
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
ProviderNotFoundError,
|
|
8
8
|
RateLimitError,
|
|
9
9
|
schemaToJsonSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3G3R4NFG.js";
|
|
11
11
|
import {
|
|
12
12
|
APP_NAME,
|
|
13
13
|
CONFIG_DIR_NAME,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
MCP_TOOL_PREFIX,
|
|
21
21
|
PLUGINS_DIR_NAME,
|
|
22
22
|
VERSION
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NCPGLZIQ.js";
|
|
24
24
|
|
|
25
25
|
// src/config/config-manager.ts
|
|
26
26
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -2104,13 +2104,12 @@ var OllamaProvider = class extends OpenAICompatibleProvider {
|
|
|
2104
2104
|
dynamicModels = [];
|
|
2105
2105
|
/** 是否已成功连接过 Ollama */
|
|
2106
2106
|
connected = false;
|
|
2107
|
-
/**
|
|
2107
|
+
/** base URL(不含 /v1),用于错误提示 */
|
|
2108
2108
|
ollamaHost = "http://localhost:11434";
|
|
2109
2109
|
info = {
|
|
2110
2110
|
id: "ollama",
|
|
2111
2111
|
displayName: "Ollama (Local)",
|
|
2112
2112
|
defaultModel: "",
|
|
2113
|
-
// 动态设置
|
|
2114
2113
|
apiKeyEnvVar: "",
|
|
2115
2114
|
requiresApiKey: false,
|
|
2116
2115
|
baseUrl: this.defaultBaseUrl,
|
|
@@ -2123,23 +2122,30 @@ var OllamaProvider = class extends OpenAICompatibleProvider {
|
|
|
2123
2122
|
await this.tryConnect();
|
|
2124
2123
|
}
|
|
2125
2124
|
/**
|
|
2126
|
-
*
|
|
2125
|
+
* 尝试通过 OpenAI client 的 models.list() 刷新 Ollama 模型列表。
|
|
2127
2126
|
* 成功返回 true,失败返回 false(不抛异常)。
|
|
2128
2127
|
*/
|
|
2129
2128
|
async tryConnect() {
|
|
2130
2129
|
try {
|
|
2131
|
-
|
|
2132
|
-
|
|
2130
|
+
const response = await this.client.models.list();
|
|
2131
|
+
const modelIds = response.data.map((m) => m.id);
|
|
2132
|
+
if (modelIds.length === 0) {
|
|
2133
2133
|
this.connected = false;
|
|
2134
2134
|
return false;
|
|
2135
2135
|
}
|
|
2136
|
-
|
|
2136
|
+
this.dynamicModels = modelIds.map((id) => ({
|
|
2137
|
+
id,
|
|
2138
|
+
displayName: id,
|
|
2139
|
+
contextWindow: this.estimateContextWindow(id),
|
|
2140
|
+
supportsStreaming: true,
|
|
2141
|
+
supportsThinking: false
|
|
2142
|
+
}));
|
|
2143
|
+
const preferred = ["llama3.1", "llama3", "qwen2.5", "qwen3", "qwen2", "deepseek-r1", "mistral", "gemma2", "gemma3"];
|
|
2137
2144
|
const defaultModel = this.dynamicModels.find(
|
|
2138
2145
|
(m) => preferred.some((p) => m.id.startsWith(p))
|
|
2139
2146
|
)?.id ?? this.dynamicModels[0].id;
|
|
2140
2147
|
Object.assign(this.info, {
|
|
2141
2148
|
defaultModel,
|
|
2142
|
-
baseUrl: `${this.ollamaHost}/v1`,
|
|
2143
2149
|
models: this.dynamicModels
|
|
2144
2150
|
});
|
|
2145
2151
|
this.connected = true;
|
|
@@ -2149,44 +2155,6 @@ var OllamaProvider = class extends OpenAICompatibleProvider {
|
|
|
2149
2155
|
return false;
|
|
2150
2156
|
}
|
|
2151
2157
|
}
|
|
2152
|
-
/**
|
|
2153
|
-
* 确保已连接。在 chat/chatStream 前调用,若未连接则尝试重连。
|
|
2154
|
-
*/
|
|
2155
|
-
async ensureConnected() {
|
|
2156
|
-
if (this.connected && this.dynamicModels.length > 0) return;
|
|
2157
|
-
const ok = await this.tryConnect();
|
|
2158
|
-
if (!ok) {
|
|
2159
|
-
throw new ProviderError(
|
|
2160
|
-
"ollama",
|
|
2161
|
-
`Cannot connect to Ollama at ${this.ollamaHost}. Make sure Ollama is running (\`ollama serve\`) and has models installed (\`ollama pull <model>\`).`
|
|
2162
|
-
);
|
|
2163
|
-
}
|
|
2164
|
-
}
|
|
2165
|
-
/**
|
|
2166
|
-
* 从 Ollama /api/tags 获取本地模型列表。
|
|
2167
|
-
*/
|
|
2168
|
-
async fetchModels(ollamaHost) {
|
|
2169
|
-
const url = `${ollamaHost}/api/tags`;
|
|
2170
|
-
const response = await fetch(url, { signal: AbortSignal.timeout(5e3) });
|
|
2171
|
-
if (!response.ok) {
|
|
2172
|
-
throw new Error(`Ollama API error: ${response.status} ${response.statusText}`);
|
|
2173
|
-
}
|
|
2174
|
-
const data = await response.json();
|
|
2175
|
-
if (!data.models || data.models.length === 0) {
|
|
2176
|
-
return [];
|
|
2177
|
-
}
|
|
2178
|
-
return data.models.map((m) => {
|
|
2179
|
-
const paramSize = m.details?.parameter_size ?? "";
|
|
2180
|
-
const sizeGB = (m.size / 1e9).toFixed(1);
|
|
2181
|
-
return {
|
|
2182
|
-
id: m.name,
|
|
2183
|
-
displayName: `${m.name} (${paramSize || sizeGB + "GB"})`,
|
|
2184
|
-
contextWindow: this.estimateContextWindow(m.name),
|
|
2185
|
-
supportsStreaming: true,
|
|
2186
|
-
supportsThinking: false
|
|
2187
|
-
};
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
2158
|
/** 根据模型名估算上下文窗口 */
|
|
2191
2159
|
estimateContextWindow(modelName) {
|
|
2192
2160
|
const name = modelName.toLowerCase();
|
|
@@ -387,7 +387,7 @@ ${content}`);
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
390
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
390
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-6AVTEKH4.js");
|
|
391
391
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
392
392
|
let interrupted = false;
|
|
393
393
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
saveDevState,
|
|
25
25
|
sessionHasMeaningfulContent,
|
|
26
26
|
setupProxy
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-2WCIKGEH.js";
|
|
28
28
|
import {
|
|
29
29
|
ToolExecutor,
|
|
30
30
|
ToolRegistry,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
spawnAgentContext,
|
|
38
38
|
theme,
|
|
39
39
|
undoStack
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-3G3R4NFG.js";
|
|
41
41
|
import {
|
|
42
42
|
fileCheckpoints
|
|
43
43
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
SKILLS_DIR_NAME,
|
|
62
62
|
VERSION,
|
|
63
63
|
buildUserIdentityPrompt
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-NCPGLZIQ.js";
|
|
65
65
|
|
|
66
66
|
// src/index.ts
|
|
67
67
|
import { program } from "commander";
|
|
@@ -2098,7 +2098,7 @@ ${hint}` : "")
|
|
|
2098
2098
|
usage: "/test [command|filter]",
|
|
2099
2099
|
async execute(args, ctx) {
|
|
2100
2100
|
try {
|
|
2101
|
-
const { executeTests } = await import("./run-tests-
|
|
2101
|
+
const { executeTests } = await import("./run-tests-2PI4DIQM.js");
|
|
2102
2102
|
const argStr = args.join(" ").trim();
|
|
2103
2103
|
let testArgs = {};
|
|
2104
2104
|
if (argStr) {
|
|
@@ -5469,7 +5469,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5469
5469
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5470
5470
|
process.exit(1);
|
|
5471
5471
|
}
|
|
5472
|
-
const { startWebServer } = await import("./server-
|
|
5472
|
+
const { startWebServer } = await import("./server-HDJXB7RH.js");
|
|
5473
5473
|
await startWebServer({ port, host: options.host });
|
|
5474
5474
|
});
|
|
5475
5475
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -5702,7 +5702,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
5702
5702
|
}),
|
|
5703
5703
|
config.get("customProviders")
|
|
5704
5704
|
);
|
|
5705
|
-
const { startHub } = await import("./hub-
|
|
5705
|
+
const { startHub } = await import("./hub-EEZCFZHN.js");
|
|
5706
5706
|
await startHub(
|
|
5707
5707
|
{
|
|
5708
5708
|
topic: topic ?? "",
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
hadPreviousWriteToolCalls,
|
|
16
16
|
loadDevState,
|
|
17
17
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2WCIKGEH.js";
|
|
19
19
|
import {
|
|
20
20
|
AuthManager
|
|
21
21
|
} from "./chunk-BYNY5JPB.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
spawnAgentContext,
|
|
34
34
|
truncateOutput,
|
|
35
35
|
undoStack
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-3G3R4NFG.js";
|
|
37
37
|
import "./chunk-4BKXL7SM.js";
|
|
38
38
|
import {
|
|
39
39
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
SKILLS_DIR_NAME,
|
|
53
53
|
VERSION,
|
|
54
54
|
buildUserIdentityPrompt
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-NCPGLZIQ.js";
|
|
56
56
|
|
|
57
57
|
// src/web/server.ts
|
|
58
58
|
import express from "express";
|
|
@@ -1606,7 +1606,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
1606
1606
|
case "test": {
|
|
1607
1607
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
1608
1608
|
try {
|
|
1609
|
-
const { executeTests } = await import("./run-tests-
|
|
1609
|
+
const { executeTests } = await import("./run-tests-2PI4DIQM.js");
|
|
1610
1610
|
const argStr = args.join(" ").trim();
|
|
1611
1611
|
let testArgs = {};
|
|
1612
1612
|
if (argStr) {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
getDangerLevel,
|
|
5
5
|
googleSearchContext,
|
|
6
6
|
truncateOutput
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3G3R4NFG.js";
|
|
8
8
|
import "./chunk-4BKXL7SM.js";
|
|
9
9
|
import {
|
|
10
10
|
SUBAGENT_ALLOWED_TOOLS
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NCPGLZIQ.js";
|
|
12
12
|
|
|
13
13
|
// src/hub/task-orchestrator.ts
|
|
14
14
|
import { createInterface } from "readline";
|