grepmax 0.13.3 → 0.13.4

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.
@@ -45,12 +45,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
45
45
  exports.llm = void 0;
46
46
  const path = __importStar(require("node:path"));
47
47
  const commander_1 = require("commander");
48
+ const index_config_1 = require("../lib/index/index-config");
48
49
  const exit_1 = require("../lib/utils/exit");
49
50
  function showStatus() {
50
51
  return __awaiter(this, void 0, void 0, function* () {
52
+ const config = (0, index_config_1.readGlobalConfig)();
53
+ const enabled = config.llmEnabled === true;
51
54
  const { isDaemonRunning, sendDaemonCommand } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/daemon-client")));
52
55
  if (!(yield isDaemonRunning())) {
53
- console.log("LLM server: not running (daemon not started)");
56
+ console.log(`LLM: ${enabled ? "enabled" : "disabled"} · server not running (daemon not started)`);
54
57
  return;
55
58
  }
56
59
  const resp = yield sendDaemonCommand({ cmd: "llm-status" });
@@ -64,12 +67,12 @@ function showStatus() {
64
67
  const uptime = Number(resp.uptime) || 0;
65
68
  const mins = Math.floor(uptime / 60);
66
69
  const secs = uptime % 60;
67
- console.log(`LLM server: running (PID: ${resp.pid}, port: ${resp.port})`);
70
+ console.log(`LLM: enabled · running (PID: ${resp.pid}, port: ${resp.port})`);
68
71
  console.log(` Model: ${model}`);
69
72
  console.log(` Uptime: ${mins}m ${secs}s`);
70
73
  }
71
74
  else {
72
- console.log("LLM server: not running");
75
+ console.log(`LLM: ${enabled ? "enabled" : "disabled"} · server not running`);
73
76
  }
74
77
  });
75
78
  }
@@ -141,3 +144,40 @@ exports.llm
141
144
  yield (0, exit_1.gracefulExit)();
142
145
  }
143
146
  }));
147
+ exports.llm
148
+ .command("on")
149
+ .description("Enable LLM features (allows server to start)")
150
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
151
+ try {
152
+ const config = (0, index_config_1.readGlobalConfig)();
153
+ config.llmEnabled = true;
154
+ (0, index_config_1.writeGlobalConfig)(config);
155
+ console.log("LLM enabled. Use `gmax llm start` to start the server.");
156
+ }
157
+ finally {
158
+ yield (0, exit_1.gracefulExit)();
159
+ }
160
+ }));
161
+ exports.llm
162
+ .command("off")
163
+ .description("Disable LLM features and stop the server if running")
164
+ .action(() => __awaiter(void 0, void 0, void 0, function* () {
165
+ try {
166
+ // Stop server if running
167
+ const { isDaemonRunning, sendDaemonCommand } = yield Promise.resolve().then(() => __importStar(require("../lib/utils/daemon-client")));
168
+ if (yield isDaemonRunning()) {
169
+ const status = yield sendDaemonCommand({ cmd: "llm-status" });
170
+ if (status.ok && status.running) {
171
+ yield sendDaemonCommand({ cmd: "llm-stop" });
172
+ console.log("LLM server stopped.");
173
+ }
174
+ }
175
+ const config = (0, index_config_1.readGlobalConfig)();
176
+ config.llmEnabled = false;
177
+ (0, index_config_1.writeGlobalConfig)(config);
178
+ console.log("LLM disabled. Server will not auto-start.");
179
+ }
180
+ finally {
181
+ yield (0, exit_1.gracefulExit)();
182
+ }
183
+ }));
@@ -47,6 +47,7 @@ const node_child_process_1 = require("node:child_process");
47
47
  const fs = __importStar(require("node:fs"));
48
48
  const http = __importStar(require("node:http"));
49
49
  const config_1 = require("../../config");
50
+ const index_config_1 = require("../index/index-config");
50
51
  const log_rotate_1 = require("../utils/log-rotate");
51
52
  const config_2 = require("./config");
52
53
  const HEALTH_TIMEOUT_MS = 2000;
@@ -79,9 +80,16 @@ class LlmServer {
79
80
  });
80
81
  });
81
82
  }
83
+ /** Check if LLM is enabled in global config. */
84
+ isEnabled() {
85
+ return (0, index_config_1.readGlobalConfig)().llmEnabled === true;
86
+ }
82
87
  /** Start llama-server, poll until ready, start idle watchdog. */
83
88
  start() {
84
89
  return __awaiter(this, void 0, void 0, function* () {
90
+ if (!this.isEnabled()) {
91
+ throw new Error("LLM is disabled. Run `gmax llm on` to enable.");
92
+ }
85
93
  if (yield this.healthy()) {
86
94
  // Adopt an existing server (e.g. after daemon crash + restart)
87
95
  this.lastRequestTime = Date.now();
@@ -191,9 +199,12 @@ class LlmServer {
191
199
  console.log(`[llm] Server force-killed (PID: ${pid})`);
192
200
  });
193
201
  }
194
- /** Start if not running. */
202
+ /** Start if not running. Respects llmEnabled config. */
195
203
  ensure() {
196
204
  return __awaiter(this, void 0, void 0, function* () {
205
+ if (!this.isEnabled()) {
206
+ throw new Error("LLM is disabled. Run `gmax llm on` to enable.");
207
+ }
197
208
  if (yield this.healthy()) {
198
209
  this.touchIdle();
199
210
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "author": "Robert Owens <78518764+reowens@users.noreply.github.com>",
5
5
  "homepage": "https://github.com/reowens/grepmax",
6
6
  "bugs": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
5
5
  "author": {
6
6
  "name": "Robert Owens",