jinzd-ai-cli 0.4.33 → 0.4.34
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-PHKIBOYX.js → chunk-3T6UI6JT.js} +1 -1
- package/dist/{chunk-QUHABI3Q.js → chunk-G4YXWCA2.js} +2 -2
- package/dist/{chunk-HI7WP73P.js → chunk-XBSFS4Z3.js} +1 -1
- package/dist/{chunk-BIMGUPLT.js → chunk-YFXZ275D.js} +1 -1
- package/dist/{hub-H4GR45XE.js → hub-WISCPSXJ.js} +1 -1
- package/dist/index.js +68 -7
- package/dist/{run-tests-BA6ZL2QS.js → run-tests-CPXYABFB.js} +1 -1
- package/dist/{run-tests-MYDGL7IB.js → run-tests-G3MMJS6Y.js} +1 -1
- package/dist/{server-MHRSLD7P.js → server-4EPEVN6P.js} +4 -4
- package/dist/{task-orchestrator-PJCFJMMW.js → task-orchestrator-7BBSI7N6.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-XBSFS4Z3.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-YFXZ275D.js";
|
|
24
24
|
|
|
25
25
|
// src/config/config-manager.ts
|
|
26
26
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -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-7BBSI7N6.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-G4YXWCA2.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-XBSFS4Z3.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-YFXZ275D.js";
|
|
65
65
|
|
|
66
66
|
// src/index.ts
|
|
67
67
|
import { program } from "commander";
|
|
@@ -2087,7 +2087,7 @@ ${hint}` : "")
|
|
|
2087
2087
|
usage: "/test [command|filter]",
|
|
2088
2088
|
async execute(args, ctx) {
|
|
2089
2089
|
try {
|
|
2090
|
-
const { executeTests } = await import("./run-tests-
|
|
2090
|
+
const { executeTests } = await import("./run-tests-G3MMJS6Y.js");
|
|
2091
2091
|
const argStr = args.join(" ").trim();
|
|
2092
2092
|
let testArgs = {};
|
|
2093
2093
|
if (argStr) {
|
|
@@ -2737,8 +2737,11 @@ var PROVIDERS = [
|
|
|
2737
2737
|
{ value: "zhipu", name: "Zhipu (GLM)" },
|
|
2738
2738
|
{ value: "kimi", name: "Kimi (Moonshot AI)" },
|
|
2739
2739
|
{ value: "openai", name: "OpenAI" },
|
|
2740
|
-
{ value: "openrouter", name: "OpenRouter" }
|
|
2740
|
+
{ value: "openrouter", name: "OpenRouter" },
|
|
2741
|
+
{ value: "ollama", name: "Ollama (Local)" }
|
|
2741
2742
|
];
|
|
2743
|
+
var NO_KEY_PROVIDERS = /* @__PURE__ */ new Set(["ollama"]);
|
|
2744
|
+
var OLLAMA_DEFAULT_HOST = "http://localhost:11434";
|
|
2742
2745
|
function maskKey(key) {
|
|
2743
2746
|
if (key.length <= 10) return "****";
|
|
2744
2747
|
return key.slice(0, 6) + "****" + key.slice(-4);
|
|
@@ -2798,6 +2801,9 @@ ${greeting} Starting ai-cli...
|
|
|
2798
2801
|
await this.setupGoogleSearch();
|
|
2799
2802
|
} else if (action === "apikey") {
|
|
2800
2803
|
const choicesWithStatus = PROVIDERS.map((p) => {
|
|
2804
|
+
if (NO_KEY_PROVIDERS.has(p.value)) {
|
|
2805
|
+
return { value: p.value, name: `${p.name} ${theme.dim("[no API key needed]")}` };
|
|
2806
|
+
}
|
|
2801
2807
|
const existingKey = this.config.getApiKey(p.value);
|
|
2802
2808
|
const status = existingKey ? theme.success(`[${maskKey(existingKey)}]`) : theme.dim("[not configured]");
|
|
2803
2809
|
return { value: p.value, name: `${p.name} ${status}` };
|
|
@@ -2822,6 +2828,10 @@ ${greeting} Starting ai-cli...
|
|
|
2822
2828
|
}
|
|
2823
2829
|
}
|
|
2824
2830
|
async setupProvider(providerId) {
|
|
2831
|
+
if (NO_KEY_PROVIDERS.has(providerId)) {
|
|
2832
|
+
await this.setupOllama();
|
|
2833
|
+
return;
|
|
2834
|
+
}
|
|
2825
2835
|
const provider = PROVIDERS.find((p) => p.value === providerId);
|
|
2826
2836
|
const displayName = provider?.name ?? providerId;
|
|
2827
2837
|
const existingKey = this.config.getApiKey(providerId);
|
|
@@ -2864,6 +2874,57 @@ Managing ${displayName} API Key`);
|
|
|
2864
2874
|
console.log(theme.success(`API key saved for ${displayName}: ${maskKey(newKey)}
|
|
2865
2875
|
`));
|
|
2866
2876
|
}
|
|
2877
|
+
/** Ollama 专用配置:检测连通性、发现本地模型、可选自定义地址 */
|
|
2878
|
+
async setupOllama() {
|
|
2879
|
+
console.log(theme.heading("\n\u{1F999} Ollama (Local) Configuration"));
|
|
2880
|
+
console.log(theme.dim(" Ollama runs AI models locally \u2014 no API key needed."));
|
|
2881
|
+
console.log(theme.dim(" Install: https://ollama.com\n"));
|
|
2882
|
+
const customBaseUrls = this.config.get("customBaseUrls") ?? {};
|
|
2883
|
+
const currentHost = customBaseUrls["ollama"] ? customBaseUrls["ollama"].replace(/\/v1\/?$/, "") : OLLAMA_DEFAULT_HOST;
|
|
2884
|
+
const ollamaHost = await input({
|
|
2885
|
+
message: "Ollama server address:",
|
|
2886
|
+
default: currentHost,
|
|
2887
|
+
validate: (val) => {
|
|
2888
|
+
if (!val) return "Address cannot be empty";
|
|
2889
|
+
if (!val.startsWith("http://") && !val.startsWith("https://")) {
|
|
2890
|
+
return "Must start with http:// or https://";
|
|
2891
|
+
}
|
|
2892
|
+
return true;
|
|
2893
|
+
}
|
|
2894
|
+
});
|
|
2895
|
+
const host = ollamaHost.replace(/\/+$/, "");
|
|
2896
|
+
console.log(theme.dim(`
|
|
2897
|
+
Connecting to ${host}...`));
|
|
2898
|
+
let models = [];
|
|
2899
|
+
try {
|
|
2900
|
+
const res = await fetch(`${host}/api/tags`, { signal: AbortSignal.timeout(5e3) });
|
|
2901
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
2902
|
+
const data = await res.json();
|
|
2903
|
+
models = data.models ?? [];
|
|
2904
|
+
} catch {
|
|
2905
|
+
console.log(theme.error(` \u2717 Cannot connect to Ollama at ${host}`));
|
|
2906
|
+
console.log(theme.dim(" Make sure Ollama is running: ollama serve\n"));
|
|
2907
|
+
return;
|
|
2908
|
+
}
|
|
2909
|
+
if (models.length === 0) {
|
|
2910
|
+
console.log(theme.warning(" \u26A0 Ollama is running but no models installed."));
|
|
2911
|
+
console.log(theme.dim(" Install a model: ollama pull llama3.1\n"));
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
console.log(theme.success(` \u2713 Connected! Found ${models.length} model(s):
|
|
2915
|
+
`));
|
|
2916
|
+
for (const m of models) {
|
|
2917
|
+
const size = m.details?.parameter_size ?? `${(m.size / 1e9).toFixed(1)}GB`;
|
|
2918
|
+
console.log(` \u2022 ${m.name} ${theme.dim(`(${size})`)}`);
|
|
2919
|
+
}
|
|
2920
|
+
console.log();
|
|
2921
|
+
if (host !== OLLAMA_DEFAULT_HOST) {
|
|
2922
|
+
const urls = { ...customBaseUrls, ollama: `${host}/v1` };
|
|
2923
|
+
this.config.set("customBaseUrls", urls);
|
|
2924
|
+
}
|
|
2925
|
+
this.config.save();
|
|
2926
|
+
console.log(theme.success(" Ollama configured! Use /provider ollama to switch.\n"));
|
|
2927
|
+
}
|
|
2867
2928
|
async setupProxy() {
|
|
2868
2929
|
const current = this.config.get("proxy") ?? "";
|
|
2869
2930
|
console.log("\nHTTP/HTTPS Proxy Configuration");
|
|
@@ -5397,7 +5458,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5397
5458
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5398
5459
|
process.exit(1);
|
|
5399
5460
|
}
|
|
5400
|
-
const { startWebServer } = await import("./server-
|
|
5461
|
+
const { startWebServer } = await import("./server-4EPEVN6P.js");
|
|
5401
5462
|
await startWebServer({ port, host: options.host });
|
|
5402
5463
|
});
|
|
5403
5464
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -5630,7 +5691,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
5630
5691
|
}),
|
|
5631
5692
|
config.get("customProviders")
|
|
5632
5693
|
);
|
|
5633
|
-
const { startHub } = await import("./hub-
|
|
5694
|
+
const { startHub } = await import("./hub-WISCPSXJ.js");
|
|
5634
5695
|
await startHub(
|
|
5635
5696
|
{
|
|
5636
5697
|
topic: topic ?? "",
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
hadPreviousWriteToolCalls,
|
|
16
16
|
loadDevState,
|
|
17
17
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-G4YXWCA2.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-XBSFS4Z3.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-YFXZ275D.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-G3MMJS6Y.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-XBSFS4Z3.js";
|
|
8
8
|
import "./chunk-4BKXL7SM.js";
|
|
9
9
|
import {
|
|
10
10
|
SUBAGENT_ALLOWED_TOOLS
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YFXZ275D.js";
|
|
12
12
|
|
|
13
13
|
// src/hub/task-orchestrator.ts
|
|
14
14
|
import { createInterface } from "readline";
|