jinzd-ai-cli 0.4.217 → 0.4.219
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/README.md +5 -2
- package/dist/{batch-YCOVKTXD.js → batch-CHAPYRVM.js} +2 -2
- package/dist/chunk-3I4RZYYO.js +638 -0
- package/dist/{chunk-KOPUCJXM.js → chunk-4ZN6L6K5.js} +3 -3
- package/dist/{chunk-VTH7BLXK.js → chunk-64NUW3WL.js} +1 -1
- package/dist/{chunk-QAYOI57M.js → chunk-EGMORH5W.js} +1 -1
- package/dist/{chunk-MGBMNCHG.js → chunk-GEN4O5QH.js} +94 -270
- package/dist/chunk-GGKQHPB3.js +604 -0
- package/dist/{chunk-WKOQ5CYC.js → chunk-KIEZBTVD.js} +1 -1
- package/dist/{chunk-OUAZOE5U.js → chunk-QUFYBR6Q.js} +47 -206
- package/dist/{chunk-XJGEQIYS.js → chunk-U7KVU25H.js} +1 -1
- package/dist/{chunk-WZ3VKLF3.js → chunk-VADHBW7T.js} +1 -1
- package/dist/{ci-52RZIYWB.js → ci-QPP66T53.js} +4 -4
- package/dist/{ci-format-73UXKE65.js → ci-format-5S3EEYRK.js} +2 -2
- package/dist/{constants-DIXAD35W.js → constants-FJOLBABC.js} +1 -1
- package/dist/doctor-cli-KB2LUDF3.js +17 -0
- package/dist/electron-server.js +921 -274
- package/dist/{hub-GIGBITZN.js → hub-DIM7SKKY.js} +1 -1
- package/dist/index.js +192 -200
- package/dist/{pr-KPQ5RPKB.js → pr-YQGH72N6.js} +4 -4
- package/dist/{run-tests-ZDSA3QES.js → run-tests-GEZSSNJM.js} +2 -2
- package/dist/{run-tests-K7QR5QN4.js → run-tests-O76JIBCW.js} +1 -1
- package/dist/{server-QT3SC2KI.js → server-5E2AIXVX.js} +108 -80
- package/dist/{server-22YF3U34.js → server-Z6O3G2LY.js} +9 -9
- package/dist/{task-orchestrator-BHQQCVTY.js → task-orchestrator-5HBW4O64.js} +9 -9
- package/dist/{usage-WZZFSFLM.js → usage-BMK6M5U3.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-524WZOKS.js +0 -166
- package/dist/chunk-SNJAOXFT.js +0 -129
- package/dist/doctor-cli-7GOQPULZ.js +0 -226
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-4ZN6L6K5.js";
|
|
6
|
+
import "./chunk-VADHBW7T.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReviewPrompt,
|
|
9
9
|
buildSecurityReviewPrompt,
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
import "./chunk-XPBEJB27.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KIEZBTVD.js";
|
|
19
19
|
import "./chunk-TZQHYZKT.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-U7KVU25H.js";
|
|
23
23
|
import "./chunk-IW3Q7AE5.js";
|
|
24
24
|
|
|
25
25
|
// src/cli/pr.ts
|
|
@@ -17,14 +17,13 @@ import {
|
|
|
17
17
|
SkillManager,
|
|
18
18
|
autoTrimSessionIfNeeded,
|
|
19
19
|
buildInitPrompt,
|
|
20
|
-
loadContextFiles,
|
|
21
20
|
loadDevState,
|
|
22
21
|
persistToolRound,
|
|
23
22
|
readGitDiff,
|
|
24
23
|
scanDirTree,
|
|
25
24
|
scanProject,
|
|
26
25
|
setupProxy
|
|
27
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QUFYBR6Q.js";
|
|
28
27
|
import {
|
|
29
28
|
buildReviewPrompt,
|
|
30
29
|
buildSecurityReviewPrompt
|
|
@@ -45,7 +44,6 @@ import {
|
|
|
45
44
|
exportMemoryEntries,
|
|
46
45
|
formatMemoryForPrompt,
|
|
47
46
|
formatPermissionProfileWarning,
|
|
48
|
-
getPendingHookTrust,
|
|
49
47
|
getPreferredAgentName,
|
|
50
48
|
getRecentlyDeniedAutoActions,
|
|
51
49
|
googleSearchContext,
|
|
@@ -59,8 +57,6 @@ import {
|
|
|
59
57
|
renderDiff,
|
|
60
58
|
requestAgentStop,
|
|
61
59
|
resolveAgentConfig,
|
|
62
|
-
runHook,
|
|
63
|
-
runLifecycleHooks,
|
|
64
60
|
runSafePhases,
|
|
65
61
|
runWithSessionKey,
|
|
66
62
|
setContextWindow,
|
|
@@ -70,10 +66,11 @@ import {
|
|
|
70
66
|
truncateOutput,
|
|
71
67
|
undoStack,
|
|
72
68
|
updateMemoryApproval
|
|
73
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-GEN4O5QH.js";
|
|
70
|
+
import "./chunk-K3CF65QH.js";
|
|
74
71
|
import "./chunk-T2NL5ZIA.js";
|
|
75
72
|
import "./chunk-BXP6YZ2P.js";
|
|
76
|
-
import "./chunk-
|
|
73
|
+
import "./chunk-64NUW3WL.js";
|
|
77
74
|
import {
|
|
78
75
|
SessionManager,
|
|
79
76
|
getContentText
|
|
@@ -82,12 +79,35 @@ import {
|
|
|
82
79
|
computeCost,
|
|
83
80
|
formatCost
|
|
84
81
|
} from "./chunk-E44DTERW.js";
|
|
82
|
+
import "./chunk-4BKXL7SM.js";
|
|
83
|
+
import "./chunk-TB4W4Y4T.js";
|
|
84
|
+
import "./chunk-KHYD3WXE.js";
|
|
85
|
+
import {
|
|
86
|
+
scanString
|
|
87
|
+
} from "./chunk-SLSWPBK3.js";
|
|
88
|
+
import {
|
|
89
|
+
buildDoctorReport,
|
|
90
|
+
formatDoctorReport,
|
|
91
|
+
loadContextFiles
|
|
92
|
+
} from "./chunk-3I4RZYYO.js";
|
|
85
93
|
import {
|
|
86
94
|
ProviderRegistry
|
|
87
95
|
} from "./chunk-QMXC327F.js";
|
|
88
96
|
import {
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
describePlugin,
|
|
98
|
+
getActivePluginAssets,
|
|
99
|
+
getInstalledPlugin,
|
|
100
|
+
getPendingHookTrust,
|
|
101
|
+
installPlugin,
|
|
102
|
+
listInstalledPlugins,
|
|
103
|
+
mergePluginHooks,
|
|
104
|
+
pluginRoot,
|
|
105
|
+
runHook,
|
|
106
|
+
runLifecycleHooks,
|
|
107
|
+
runTool,
|
|
108
|
+
setPluginEnabled,
|
|
109
|
+
trustPlugin
|
|
110
|
+
} from "./chunk-GGKQHPB3.js";
|
|
91
111
|
import {
|
|
92
112
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
93
113
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -106,7 +126,7 @@ import {
|
|
|
106
126
|
} from "./chunk-XPBEJB27.js";
|
|
107
127
|
import {
|
|
108
128
|
ConfigManager
|
|
109
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-KIEZBTVD.js";
|
|
110
130
|
import "./chunk-TZQHYZKT.js";
|
|
111
131
|
import {
|
|
112
132
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -124,19 +144,12 @@ import {
|
|
|
124
144
|
SKILLS_DIR_NAME,
|
|
125
145
|
VERSION,
|
|
126
146
|
buildUserIdentityPrompt
|
|
127
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-U7KVU25H.js";
|
|
128
148
|
import {
|
|
129
149
|
formatGitContextForPrompt,
|
|
130
150
|
getGitContext,
|
|
131
151
|
getGitRoot
|
|
132
152
|
} from "./chunk-HOSJZMQS.js";
|
|
133
|
-
import "./chunk-4BKXL7SM.js";
|
|
134
|
-
import "./chunk-TB4W4Y4T.js";
|
|
135
|
-
import "./chunk-KHYD3WXE.js";
|
|
136
|
-
import {
|
|
137
|
-
scanString
|
|
138
|
-
} from "./chunk-SLSWPBK3.js";
|
|
139
|
-
import "./chunk-K3CF65QH.js";
|
|
140
153
|
import "./chunk-CKH4KQ4E.js";
|
|
141
154
|
import {
|
|
142
155
|
atomicWriteFileSync
|
|
@@ -748,7 +761,7 @@ var SessionHandler = class {
|
|
|
748
761
|
}
|
|
749
762
|
this.updateContextWindow();
|
|
750
763
|
this.activeSystemPrompt = this.loadContextFiles();
|
|
751
|
-
const hooks = this.config.get("hooks");
|
|
764
|
+
const hooks = mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir());
|
|
752
765
|
const permissionRules = this.config.get("permissionRules");
|
|
753
766
|
const defaultPermission = this.config.get("defaultPermission");
|
|
754
767
|
const permissionProfileName = this.config.get("defaultPermissionProfile") ?? "legacy";
|
|
@@ -895,7 +908,7 @@ var SessionHandler = class {
|
|
|
895
908
|
}
|
|
896
909
|
}
|
|
897
910
|
onDisconnect() {
|
|
898
|
-
runLifecycleHooks(this.config.get("hooks") ?? void 0, "Stop", { sessionId: this.sessions.current?.id }, { configDir: this.config.getConfigDir() });
|
|
911
|
+
runLifecycleHooks(mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir()), "Stop", { sessionId: this.sessions.current?.id }, { configDir: this.config.getConfigDir() });
|
|
899
912
|
this.toolExecutor.cancelAll();
|
|
900
913
|
if (this.abortController) this.abortController.abort();
|
|
901
914
|
for (const resolve3 of this.pendingAskUser.values()) resolve3(null);
|
|
@@ -1074,7 +1087,7 @@ var SessionHandler = class {
|
|
|
1074
1087
|
this.ensureSession();
|
|
1075
1088
|
const session = this.sessions.current;
|
|
1076
1089
|
const promptDecisions = runLifecycleHooks(
|
|
1077
|
-
this.config.get("hooks") ?? void 0,
|
|
1090
|
+
mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir()),
|
|
1078
1091
|
"UserPromptSubmit",
|
|
1079
1092
|
{ sessionId: session.id, prompt: content },
|
|
1080
1093
|
{ configDir: this.config.getConfigDir(), onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
@@ -1916,6 +1929,7 @@ Tokens: in=${this.sessionTokenUsage.inputTokens} out=${this.sessionTokenUsage.ou
|
|
|
1916
1929
|
" /add-dir [path|remove] \u2014 Add/remove directory from AI context",
|
|
1917
1930
|
" /mcp [reconnect] \u2014 Show/manage MCP servers",
|
|
1918
1931
|
" /plugins \u2014 Show loaded plugins",
|
|
1932
|
+
" /plugin <cmd> \u2014 Manage package plugins",
|
|
1919
1933
|
" /commands \u2014 List custom commands",
|
|
1920
1934
|
" /doctor \u2014 Health check (API keys, config, MCP)",
|
|
1921
1935
|
" /bug \u2014 Generate bug report template",
|
|
@@ -2014,7 +2028,7 @@ ${lines.join("\n")}` });
|
|
|
2014
2028
|
this.sendToolsList();
|
|
2015
2029
|
this.sendStatus();
|
|
2016
2030
|
} else if (sub === "reload") {
|
|
2017
|
-
this.skillManager.loadSkills();
|
|
2031
|
+
this.skillManager.loadSkills(getActivePluginAssets(this.config.getConfigDir()).skillDirs);
|
|
2018
2032
|
this.send({ type: "info", message: `\u{1F504} Reloaded ${this.skillManager.listSkills().length} skill(s).` });
|
|
2019
2033
|
this.sendToolsList();
|
|
2020
2034
|
} else {
|
|
@@ -2751,7 +2765,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2751
2765
|
case "test": {
|
|
2752
2766
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
2753
2767
|
try {
|
|
2754
|
-
const { executeTests } = await import("./run-tests-
|
|
2768
|
+
const { executeTests } = await import("./run-tests-GEZSSNJM.js");
|
|
2755
2769
|
const argStr = args.join(" ").trim();
|
|
2756
2770
|
let testArgs = {};
|
|
2757
2771
|
if (argStr) {
|
|
@@ -2790,53 +2804,13 @@ Use /context reload to load it.` });
|
|
|
2790
2804
|
}
|
|
2791
2805
|
// ── /doctor ─────────────────────────────────────────────────────
|
|
2792
2806
|
case "doctor": {
|
|
2793
|
-
const
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
}
|
|
2801
|
-
lines.push("");
|
|
2802
|
-
const configDir = this.config.getConfigDir();
|
|
2803
|
-
lines.push("**Config Files:**");
|
|
2804
|
-
lines.push(` Dir: ${configDir}`);
|
|
2805
|
-
const checkFile = (label, filePath) => {
|
|
2806
|
-
const exists = existsSync2(filePath);
|
|
2807
|
-
let extra = "";
|
|
2808
|
-
if (exists) {
|
|
2809
|
-
try {
|
|
2810
|
-
extra = ` (${statSync(filePath).size} bytes)`;
|
|
2811
|
-
} catch {
|
|
2812
|
-
}
|
|
2813
|
-
}
|
|
2814
|
-
lines.push(` ${exists ? "\u2713" : "\u2013"} ${label.padEnd(14)} ${exists ? filePath + extra : "(not found)"}`);
|
|
2815
|
-
};
|
|
2816
|
-
checkFile("config.json", join(configDir, "config.json"));
|
|
2817
|
-
checkFile("memory.md", join(configDir, MEMORY_FILE_NAME));
|
|
2818
|
-
checkFile("dev-state.md", join(configDir, "dev-state.md"));
|
|
2819
|
-
lines.push("");
|
|
2820
|
-
if (this.mcpManager) {
|
|
2821
|
-
lines.push("**MCP Servers:**");
|
|
2822
|
-
const statuses = this.mcpManager.getStatus();
|
|
2823
|
-
if (statuses.length === 0) {
|
|
2824
|
-
lines.push(" (no servers configured)");
|
|
2825
|
-
} else {
|
|
2826
|
-
for (const s of statuses) {
|
|
2827
|
-
const state = s.connected ? `connected \xB7 ${s.serverName} \xB7 ${s.toolCount} tools` : `disconnected${s.error ? ` \xB7 ${s.error}` : ""}`;
|
|
2828
|
-
lines.push(` ${s.connected ? "\u2713" : "\u2717"} ${s.serverId.padEnd(16)} ${state}`);
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
lines.push("");
|
|
2832
|
-
}
|
|
2833
|
-
lines.push("**Current Session:**");
|
|
2834
|
-
lines.push(` Provider: ${this.currentProvider}`);
|
|
2835
|
-
lines.push(` Model: ${this.currentModel}`);
|
|
2836
|
-
lines.push(` Version: ${VERSION}`);
|
|
2837
|
-
lines.push("");
|
|
2838
|
-
lines.push("\u2713 Health check complete");
|
|
2839
|
-
this.send({ type: "info", message: lines.join("\n") });
|
|
2807
|
+
const report = buildDoctorReport({
|
|
2808
|
+
config: this.config,
|
|
2809
|
+
providers: this.providers,
|
|
2810
|
+
cwd: process.cwd(),
|
|
2811
|
+
mcpStatuses: this.mcpManager?.getStatus() ?? []
|
|
2812
|
+
});
|
|
2813
|
+
this.send({ type: "info", message: formatDoctorReport(report, false) });
|
|
2840
2814
|
break;
|
|
2841
2815
|
}
|
|
2842
2816
|
// ── /about ──────────────────────────────────────────────────────
|
|
@@ -2918,7 +2892,7 @@ ${this.config.toFormattedJSON()}
|
|
|
2918
2892
|
const result = this.contextLoadResult;
|
|
2919
2893
|
const layers = ["\u{1F4DA} **Context Layers:**", ""];
|
|
2920
2894
|
if (result && result.layers.length > 0) {
|
|
2921
|
-
const labels = { global: "Global ", project: "Project", local: "Local " };
|
|
2895
|
+
const labels = { global: "Global ", project: "Project", plugin: "Plugin ", local: "Local " };
|
|
2922
2896
|
for (const layer of result.layers) {
|
|
2923
2897
|
layers.push(` \u2713 ${labels[layer.level] ?? layer.level}: ${layer.displayPath} (${layer.charCount} chars${layer.truncated ? ", truncated" : ""})`);
|
|
2924
2898
|
}
|
|
@@ -3043,23 +3017,75 @@ Add .md files to create commands.` });
|
|
|
3043
3017
|
}
|
|
3044
3018
|
break;
|
|
3045
3019
|
}
|
|
3046
|
-
// ── /plugins
|
|
3020
|
+
// ── /plugins / /plugin ──────────────────────────────────────────
|
|
3047
3021
|
case "plugins": {
|
|
3048
3022
|
const configDir = this.config.getConfigDir();
|
|
3049
3023
|
const pluginsDir = join(configDir, PLUGINS_DIR_NAME);
|
|
3050
3024
|
const pluginTools = this.toolRegistry.listPluginTools();
|
|
3025
|
+
const pluginPackages = listInstalledPlugins(configDir);
|
|
3051
3026
|
const lines = [`\u{1F50C} **Plugins:**`, `Dir: ${pluginsDir}`, ""];
|
|
3052
|
-
if (pluginTools.length === 0) {
|
|
3027
|
+
if (pluginTools.length === 0 && pluginPackages.length === 0) {
|
|
3053
3028
|
lines.push("No plugins loaded.");
|
|
3054
|
-
lines.push("
|
|
3029
|
+
lines.push("Use /plugin install <path>, /plugin trust <name>, then /plugin enable <name>.");
|
|
3055
3030
|
} else {
|
|
3056
|
-
|
|
3057
|
-
lines.push(`
|
|
3031
|
+
if (pluginPackages.length > 0) {
|
|
3032
|
+
lines.push(`Package plugins (${pluginPackages.length}):`);
|
|
3033
|
+
for (const p of pluginPackages) lines.push(` \u2022 ${p.name}@${p.manifest.version} \u2014 ${p.enabled ? "enabled" : "disabled"} / ${p.trusted ? "trusted" : "untrusted"}`);
|
|
3034
|
+
lines.push("");
|
|
3035
|
+
}
|
|
3036
|
+
if (pluginTools.length > 0) {
|
|
3037
|
+
lines.push(`Legacy JS plugin tools (${pluginTools.length}):`);
|
|
3038
|
+
for (const t of pluginTools) lines.push(` \u2022 ${t.definition.name} \u2014 ${t.definition.description}`);
|
|
3058
3039
|
}
|
|
3059
3040
|
}
|
|
3060
3041
|
this.send({ type: "info", message: lines.join("\n") });
|
|
3061
3042
|
break;
|
|
3062
3043
|
}
|
|
3044
|
+
case "plugin": {
|
|
3045
|
+
const configDir = this.config.getConfigDir();
|
|
3046
|
+
const sub = args[0] ?? "list";
|
|
3047
|
+
try {
|
|
3048
|
+
if (sub === "list") {
|
|
3049
|
+
const plugins = listInstalledPlugins(configDir);
|
|
3050
|
+
const lines = [`\u{1F50C} **Package Plugins**`, `Dir: ${pluginRoot(configDir)}`, ""];
|
|
3051
|
+
if (plugins.length === 0) lines.push("No package plugins installed.");
|
|
3052
|
+
for (const p of plugins) lines.push(` \u2022 ${p.name}@${p.manifest.version} \u2014 ${p.enabled ? "enabled" : "disabled"} / ${p.trusted ? "trusted" : "untrusted"}`);
|
|
3053
|
+
this.send({ type: "info", message: lines.join("\n") });
|
|
3054
|
+
break;
|
|
3055
|
+
}
|
|
3056
|
+
if (sub === "install") {
|
|
3057
|
+
const input = args[1];
|
|
3058
|
+
if (!input) throw new Error("Usage: /plugin install <path>");
|
|
3059
|
+
const plugin = installPlugin(configDir, input);
|
|
3060
|
+
this.send({ type: "info", message: `Installed plugin ${plugin.name}@${plugin.manifest.version}. Run /plugin trust ${plugin.name}, then /plugin enable ${plugin.name}.` });
|
|
3061
|
+
break;
|
|
3062
|
+
}
|
|
3063
|
+
if (sub === "trust") {
|
|
3064
|
+
const name2 = args[1];
|
|
3065
|
+
if (!name2) throw new Error("Usage: /plugin trust <name>");
|
|
3066
|
+
const state = trustPlugin(configDir, name2);
|
|
3067
|
+
this.send({ type: "info", message: `Trusted plugin ${state.name}.` });
|
|
3068
|
+
break;
|
|
3069
|
+
}
|
|
3070
|
+
if (sub === "enable" || sub === "disable") {
|
|
3071
|
+
const name2 = args[1];
|
|
3072
|
+
if (!name2) throw new Error(`Usage: /plugin ${sub} <name>`);
|
|
3073
|
+
const state = setPluginEnabled(configDir, name2, sub === "enable");
|
|
3074
|
+
this.send({ type: "info", message: `${sub === "enable" ? "Enabled" : "Disabled"} plugin ${state.name}. Restart Web UI for changes to take effect.` });
|
|
3075
|
+
break;
|
|
3076
|
+
}
|
|
3077
|
+
if (sub === "inspect") {
|
|
3078
|
+
const name2 = args[1];
|
|
3079
|
+
if (!name2) throw new Error("Usage: /plugin inspect <name>");
|
|
3080
|
+
this.send({ type: "info", message: describePlugin(getInstalledPlugin(configDir, name2)).join("\n") });
|
|
3081
|
+
break;
|
|
3082
|
+
}
|
|
3083
|
+
throw new Error("Usage: /plugin [list|install|enable|disable|inspect|trust]");
|
|
3084
|
+
} catch (err) {
|
|
3085
|
+
this.send({ type: "error", message: err instanceof Error ? err.message : String(err) });
|
|
3086
|
+
}
|
|
3087
|
+
break;
|
|
3088
|
+
}
|
|
3063
3089
|
// ── /bug ────────────────────────────────────────────────────────
|
|
3064
3090
|
case "bug": {
|
|
3065
3091
|
const session = this.sessions.current;
|
|
@@ -3102,7 +3128,7 @@ Add .md files to create commands.` });
|
|
|
3102
3128
|
return;
|
|
3103
3129
|
}
|
|
3104
3130
|
const preDecisions = runLifecycleHooks(
|
|
3105
|
-
this.config.get("hooks") ?? void 0,
|
|
3131
|
+
mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir()),
|
|
3106
3132
|
"PreCompact",
|
|
3107
3133
|
{ sessionId: session.id, messageCount: session.messages.length, instruction },
|
|
3108
3134
|
{ configDir: this.config.getConfigDir(), onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
@@ -3139,7 +3165,7 @@ Add .md files to create commands.` });
|
|
|
3139
3165
|
const removedCount = session.compact(summaryMsg, ackMsg, keepLast);
|
|
3140
3166
|
const afterCount = session.messages.length;
|
|
3141
3167
|
runLifecycleHooks(
|
|
3142
|
-
this.config.get("hooks") ?? void 0,
|
|
3168
|
+
mergePluginHooks(this.config.get("hooks") ?? void 0, this.config.getConfigDir()),
|
|
3143
3169
|
"PostCompact",
|
|
3144
3170
|
{ sessionId: session.id, beforeCount, afterCount, removedCount, keepLast, instruction },
|
|
3145
3171
|
{ configDir: this.config.getConfigDir(), onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
|
|
@@ -3591,6 +3617,8 @@ async function startWebServer(options = {}) {
|
|
|
3591
3617
|
let mcpManager = null;
|
|
3592
3618
|
const mcpEnabled = config.get("mcpEnabled") !== false;
|
|
3593
3619
|
const globalMcpServers = mcpEnabled ? config.get("mcpServers") ?? {} : {};
|
|
3620
|
+
const pluginAssets = getActivePluginAssets(config.getConfigDir());
|
|
3621
|
+
const pluginMcpServers = mcpEnabled ? pluginAssets.mcpServers : {};
|
|
3594
3622
|
const projectMcpResolved = mcpEnabled ? resolveProjectMcpPath() : null;
|
|
3595
3623
|
let projectMcpServers = {};
|
|
3596
3624
|
if (projectMcpResolved) {
|
|
@@ -3603,7 +3631,7 @@ async function startWebServer(options = {}) {
|
|
|
3603
3631
|
console.log(` Skipped to prevent unintended RCE. Run "aicli" then "/mcp trust-project" to approve.`);
|
|
3604
3632
|
}
|
|
3605
3633
|
}
|
|
3606
|
-
const mergedMcpServers = { ...globalMcpServers, ...projectMcpServers };
|
|
3634
|
+
const mergedMcpServers = { ...globalMcpServers, ...pluginMcpServers, ...projectMcpServers };
|
|
3607
3635
|
if (!mcpEnabled) {
|
|
3608
3636
|
console.log(" \u{1F50C} MCP: disabled (config.mcpEnabled=false)");
|
|
3609
3637
|
}
|
|
@@ -3624,7 +3652,7 @@ async function startWebServer(options = {}) {
|
|
|
3624
3652
|
const skillsDir = join2(config.getConfigDir(), SKILLS_DIR_NAME);
|
|
3625
3653
|
if (existsSync3(skillsDir)) {
|
|
3626
3654
|
skillManager = new SkillManager(skillsDir, config.get("ui").skillSizeWarn);
|
|
3627
|
-
skillManager.loadSkills();
|
|
3655
|
+
skillManager.loadSkills(pluginAssets.skillDirs);
|
|
3628
3656
|
const count = skillManager.listSkills().length;
|
|
3629
3657
|
if (count > 0) {
|
|
3630
3658
|
console.log(` Skills: ${count} available`);
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GEN4O5QH.js";
|
|
5
|
+
import "./chunk-K3CF65QH.js";
|
|
5
6
|
import "./chunk-T2NL5ZIA.js";
|
|
6
7
|
import "./chunk-BXP6YZ2P.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-64NUW3WL.js";
|
|
9
|
+
import "./chunk-4BKXL7SM.js";
|
|
10
|
+
import "./chunk-TB4W4Y4T.js";
|
|
11
|
+
import "./chunk-KHYD3WXE.js";
|
|
12
|
+
import "./chunk-SLSWPBK3.js";
|
|
8
13
|
import {
|
|
9
14
|
runTool
|
|
10
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GGKQHPB3.js";
|
|
11
16
|
import {
|
|
12
17
|
getDangerLevel,
|
|
13
18
|
schemaToJsonSchema
|
|
@@ -15,13 +20,8 @@ import {
|
|
|
15
20
|
import "./chunk-TZQHYZKT.js";
|
|
16
21
|
import {
|
|
17
22
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-U7KVU25H.js";
|
|
19
24
|
import "./chunk-HOSJZMQS.js";
|
|
20
|
-
import "./chunk-4BKXL7SM.js";
|
|
21
|
-
import "./chunk-TB4W4Y4T.js";
|
|
22
|
-
import "./chunk-KHYD3WXE.js";
|
|
23
|
-
import "./chunk-SLSWPBK3.js";
|
|
24
|
-
import "./chunk-K3CF65QH.js";
|
|
25
25
|
import "./chunk-CKH4KQ4E.js";
|
|
26
26
|
import "./chunk-IW3Q7AE5.js";
|
|
27
27
|
|
|
@@ -3,13 +3,18 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GEN4O5QH.js";
|
|
7
|
+
import "./chunk-K3CF65QH.js";
|
|
7
8
|
import "./chunk-T2NL5ZIA.js";
|
|
8
9
|
import "./chunk-BXP6YZ2P.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-64NUW3WL.js";
|
|
11
|
+
import "./chunk-4BKXL7SM.js";
|
|
12
|
+
import "./chunk-TB4W4Y4T.js";
|
|
13
|
+
import "./chunk-KHYD3WXE.js";
|
|
14
|
+
import "./chunk-SLSWPBK3.js";
|
|
10
15
|
import {
|
|
11
16
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GGKQHPB3.js";
|
|
13
18
|
import {
|
|
14
19
|
getDangerLevel,
|
|
15
20
|
runLeanAgentLoop
|
|
@@ -17,13 +22,8 @@ import {
|
|
|
17
22
|
import "./chunk-TZQHYZKT.js";
|
|
18
23
|
import {
|
|
19
24
|
SUBAGENT_ALLOWED_TOOLS
|
|
20
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-U7KVU25H.js";
|
|
21
26
|
import "./chunk-HOSJZMQS.js";
|
|
22
|
-
import "./chunk-4BKXL7SM.js";
|
|
23
|
-
import "./chunk-TB4W4Y4T.js";
|
|
24
|
-
import "./chunk-KHYD3WXE.js";
|
|
25
|
-
import "./chunk-SLSWPBK3.js";
|
|
26
|
-
import "./chunk-K3CF65QH.js";
|
|
27
27
|
import "./chunk-CKH4KQ4E.js";
|
|
28
28
|
import {
|
|
29
29
|
atomicWriteFileSync
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "./chunk-E44DTERW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KIEZBTVD.js";
|
|
12
12
|
import "./chunk-TZQHYZKT.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-U7KVU25H.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/usage.ts
|
package/package.json
CHANGED
package/dist/chunk-524WZOKS.js
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
CONFIG_DIR_NAME,
|
|
4
|
-
VERSION
|
|
5
|
-
} from "./chunk-XJGEQIYS.js";
|
|
6
|
-
|
|
7
|
-
// src/diagnostics/crash-log.ts
|
|
8
|
-
import {
|
|
9
|
-
existsSync,
|
|
10
|
-
mkdirSync,
|
|
11
|
-
readdirSync,
|
|
12
|
-
readFileSync,
|
|
13
|
-
statSync,
|
|
14
|
-
unlinkSync,
|
|
15
|
-
writeFileSync
|
|
16
|
-
} from "fs";
|
|
17
|
-
import { join } from "path";
|
|
18
|
-
import { homedir, platform, release, arch } from "os";
|
|
19
|
-
var LOGS_DIR_NAME = "logs";
|
|
20
|
-
var CRASH_LOG_PREFIX = "crash-";
|
|
21
|
-
var MAX_CRASH_FILES = 20;
|
|
22
|
-
function getLogsDir(configDir) {
|
|
23
|
-
const base = configDir ?? join(homedir(), CONFIG_DIR_NAME);
|
|
24
|
-
return join(base, LOGS_DIR_NAME);
|
|
25
|
-
}
|
|
26
|
-
function ensureLogsDir(configDir) {
|
|
27
|
-
const dir = getLogsDir(configDir);
|
|
28
|
-
if (!existsSync(dir)) {
|
|
29
|
-
mkdirSync(dir, { recursive: true });
|
|
30
|
-
}
|
|
31
|
-
return dir;
|
|
32
|
-
}
|
|
33
|
-
function isoTimestampForFilename(d = /* @__PURE__ */ new Date()) {
|
|
34
|
-
return d.toISOString().replace(/[:.]/g, "-");
|
|
35
|
-
}
|
|
36
|
-
function writeCrashLog(err, context, configDir) {
|
|
37
|
-
try {
|
|
38
|
-
const dir = ensureLogsDir(configDir);
|
|
39
|
-
const ts = /* @__PURE__ */ new Date();
|
|
40
|
-
const file = join(dir, `${CRASH_LOG_PREFIX}${isoTimestampForFilename(ts)}.log`);
|
|
41
|
-
const errMessage = err instanceof Error ? err.message : String(err);
|
|
42
|
-
const errStack = err instanceof Error ? err.stack ?? "(no stack)" : "(non-Error thrown)";
|
|
43
|
-
const lines = [
|
|
44
|
-
`# ai-cli crash log`,
|
|
45
|
-
`timestamp: ${ts.toISOString()}`,
|
|
46
|
-
`kind: ${context.kind}`,
|
|
47
|
-
`version: ${VERSION}`,
|
|
48
|
-
`node: ${process.version}`,
|
|
49
|
-
`platform: ${platform()} ${release()} (${arch()})`,
|
|
50
|
-
`pid: ${process.pid}`,
|
|
51
|
-
context.provider ? `provider: ${context.provider}` : "",
|
|
52
|
-
context.model ? `model: ${context.model}` : "",
|
|
53
|
-
context.lastAction ? `lastAction: ${truncate(context.lastAction, 500)}` : "",
|
|
54
|
-
"",
|
|
55
|
-
`## message`,
|
|
56
|
-
errMessage,
|
|
57
|
-
"",
|
|
58
|
-
`## stack`,
|
|
59
|
-
errStack,
|
|
60
|
-
""
|
|
61
|
-
].filter(Boolean);
|
|
62
|
-
writeFileSync(file, lines.join("\n"), "utf-8");
|
|
63
|
-
pruneOldCrashes(configDir);
|
|
64
|
-
return file;
|
|
65
|
-
} catch {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function truncate(s, n) {
|
|
70
|
-
return s.length <= n ? s : s.slice(0, n) + "\u2026";
|
|
71
|
-
}
|
|
72
|
-
function pruneOldCrashes(configDir) {
|
|
73
|
-
try {
|
|
74
|
-
const dir = getLogsDir(configDir);
|
|
75
|
-
if (!existsSync(dir)) return;
|
|
76
|
-
const entries = readdirSync(dir).filter((f) => f.startsWith(CRASH_LOG_PREFIX) && f.endsWith(".log")).map((f) => {
|
|
77
|
-
const full = join(dir, f);
|
|
78
|
-
let mtime = 0;
|
|
79
|
-
try {
|
|
80
|
-
mtime = statSync(full).mtimeMs;
|
|
81
|
-
} catch {
|
|
82
|
-
}
|
|
83
|
-
return { file: full, mtime };
|
|
84
|
-
}).sort((a, b) => b.mtime - a.mtime);
|
|
85
|
-
for (const e of entries.slice(MAX_CRASH_FILES)) {
|
|
86
|
-
try {
|
|
87
|
-
unlinkSync(e.file);
|
|
88
|
-
} catch {
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
} catch {
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function listRecentCrashes(limit = 10, configDir) {
|
|
95
|
-
const dir = getLogsDir(configDir);
|
|
96
|
-
if (!existsSync(dir)) return [];
|
|
97
|
-
const files = [];
|
|
98
|
-
let names;
|
|
99
|
-
try {
|
|
100
|
-
names = readdirSync(dir);
|
|
101
|
-
} catch {
|
|
102
|
-
return [];
|
|
103
|
-
}
|
|
104
|
-
for (const name of names) {
|
|
105
|
-
if (!name.startsWith(CRASH_LOG_PREFIX) || !name.endsWith(".log")) continue;
|
|
106
|
-
const full = join(dir, name);
|
|
107
|
-
try {
|
|
108
|
-
const st = statSync(full);
|
|
109
|
-
const head = readFileSync(full, "utf-8").split("\n").slice(0, 20);
|
|
110
|
-
const tsLine = head.find((l) => l.startsWith("timestamp:"));
|
|
111
|
-
const kindLine = head.find((l) => l.startsWith("kind:"));
|
|
112
|
-
const msgIdx = head.findIndex((l) => l.trim() === "## message");
|
|
113
|
-
const message = msgIdx >= 0 && head[msgIdx + 1] ? head[msgIdx + 1] : "";
|
|
114
|
-
files.push({
|
|
115
|
-
file: full,
|
|
116
|
-
timestamp: tsLine ? tsLine.replace("timestamp:", "").trim() : st.mtime.toISOString(),
|
|
117
|
-
kind: kindLine ? kindLine.replace("kind:", "").trim() : "unknown",
|
|
118
|
-
message: truncate(message, 200),
|
|
119
|
-
sizeBytes: st.size
|
|
120
|
-
});
|
|
121
|
-
} catch {
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
files.sort((a, b) => a.timestamp < b.timestamp ? 1 : -1);
|
|
125
|
-
return files.slice(0, limit);
|
|
126
|
-
}
|
|
127
|
-
function getConfigDirUsage(configDir) {
|
|
128
|
-
const base = configDir ?? join(homedir(), CONFIG_DIR_NAME);
|
|
129
|
-
if (!existsSync(base)) return { totalBytes: 0, entries: [] };
|
|
130
|
-
const entries = [];
|
|
131
|
-
let total = 0;
|
|
132
|
-
let names;
|
|
133
|
-
try {
|
|
134
|
-
names = readdirSync(base);
|
|
135
|
-
} catch {
|
|
136
|
-
return { totalBytes: 0, entries: [] };
|
|
137
|
-
}
|
|
138
|
-
for (const name of names) {
|
|
139
|
-
const full = join(base, name);
|
|
140
|
-
const bytes = dirSize(full);
|
|
141
|
-
entries.push({ name, bytes });
|
|
142
|
-
total += bytes;
|
|
143
|
-
}
|
|
144
|
-
entries.sort((a, b) => b.bytes - a.bytes);
|
|
145
|
-
return { totalBytes: total, entries };
|
|
146
|
-
}
|
|
147
|
-
function dirSize(path) {
|
|
148
|
-
try {
|
|
149
|
-
const st = statSync(path);
|
|
150
|
-
if (st.isFile()) return st.size;
|
|
151
|
-
if (!st.isDirectory()) return 0;
|
|
152
|
-
let sum = 0;
|
|
153
|
-
for (const name of readdirSync(path)) {
|
|
154
|
-
sum += dirSize(join(path, name));
|
|
155
|
-
}
|
|
156
|
-
return sum;
|
|
157
|
-
} catch {
|
|
158
|
-
return 0;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export {
|
|
163
|
-
writeCrashLog,
|
|
164
|
-
listRecentCrashes,
|
|
165
|
-
getConfigDirUsage
|
|
166
|
-
};
|