openfox 1.6.39 → 1.6.40

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.
@@ -2,16 +2,16 @@ import {
2
2
  maybeAutoCompactContext,
3
3
  performManualContextCompaction,
4
4
  resolveCompactionStatsIdentity
5
- } from "./chunk-5NJ5NQH5.js";
5
+ } from "./chunk-QFOT3J6I.js";
6
6
  import "./chunk-NBU6KIOD.js";
7
7
  import "./chunk-574HZVLE.js";
8
+ import "./chunk-7JPKRM6M.js";
8
9
  import "./chunk-D4ZLSV6P.js";
9
10
  import "./chunk-YVQ6DP5Y.js";
10
11
  import "./chunk-LIMBYVO4.js";
11
12
  import "./chunk-DZHZ3UUR.js";
12
13
  import "./chunk-22CTURMH.js";
13
14
  import "./chunk-O2BOWZKC.js";
14
- import "./chunk-7JPKRM6M.js";
15
15
  import "./chunk-BLNFJ22S.js";
16
16
  import "./chunk-Y6HBEACI.js";
17
17
  import "./chunk-R4HADRYO.js";
@@ -23,4 +23,4 @@ export {
23
23
  performManualContextCompaction,
24
24
  resolveCompactionStatsIdentity
25
25
  };
26
- //# sourceMappingURL=auto-compaction-SCLHKKGA.js.map
26
+ //# sourceMappingURL=auto-compaction-U2TKRF6E.js.map
@@ -10,10 +10,11 @@ import {
10
10
  } from "./chunk-BHSTSA7U.js";
11
11
  import {
12
12
  runChatTurn
13
- } from "./chunk-TBSTW3PW.js";
14
- import "./chunk-5NJ5NQH5.js";
13
+ } from "./chunk-VCVHYZZS.js";
14
+ import "./chunk-QFOT3J6I.js";
15
15
  import "./chunk-NBU6KIOD.js";
16
16
  import "./chunk-574HZVLE.js";
17
+ import "./chunk-7JPKRM6M.js";
17
18
  import "./chunk-D4ZLSV6P.js";
18
19
  import {
19
20
  getEventStore
@@ -26,7 +27,6 @@ import {
26
27
  } from "./chunk-DZHZ3UUR.js";
27
28
  import "./chunk-22CTURMH.js";
28
29
  import "./chunk-O2BOWZKC.js";
29
- import "./chunk-7JPKRM6M.js";
30
30
  import "./chunk-BLNFJ22S.js";
31
31
  import "./chunk-Y6HBEACI.js";
32
32
  import "./chunk-R4HADRYO.js";
@@ -62,7 +62,7 @@ async function startChatSession(sessionId, content, deps, options) {
62
62
  sessionManager.setRunning(sessionId, true);
63
63
  broadcastForSession(sessionId, createSessionRunningMessage(true));
64
64
  try {
65
- const { maybeAutoCompactContext } = await import("./auto-compaction-SCLHKKGA.js");
65
+ const { maybeAutoCompactContext } = await import("./auto-compaction-U2TKRF6E.js");
66
66
  await maybeAutoCompactContext({
67
67
  sessionManager,
68
68
  sessionId,
@@ -171,4 +171,4 @@ export {
171
171
  startChatSession,
172
172
  stopSessionExecution
173
173
  };
174
- //# sourceMappingURL=chat-handler-7ARMDWRH.js.map
174
+ //# sourceMappingURL=chat-handler-TJWYGO3G.js.map
@@ -6,7 +6,7 @@ import {
6
6
  createVerifierNudgeConfig,
7
7
  runBuilderTurn,
8
8
  runChatTurn
9
- } from "./chunk-TBSTW3PW.js";
9
+ } from "./chunk-VCVHYZZS.js";
10
10
  import {
11
11
  TurnMetrics,
12
12
  agentExists,
@@ -47,13 +47,16 @@ import {
47
47
  setSkillEnabled,
48
48
  skillExists,
49
49
  spawnShellProcess
50
- } from "./chunk-5NJ5NQH5.js";
50
+ } from "./chunk-QFOT3J6I.js";
51
51
  import {
52
52
  getPathSeparator,
53
53
  getPlatformShell,
54
54
  isAbsolutePath,
55
55
  onProcessEvent
56
56
  } from "./chunk-NBU6KIOD.js";
57
+ import {
58
+ getProject
59
+ } from "./chunk-7JPKRM6M.js";
57
60
  import {
58
61
  createProviderManager,
59
62
  parseDefaultModelSelection
@@ -121,9 +124,6 @@ import {
121
124
  cancelQuestionsForSession,
122
125
  provideAnswer
123
126
  } from "./chunk-22CTURMH.js";
124
- import {
125
- getProject
126
- } from "./chunk-7JPKRM6M.js";
127
127
  import {
128
128
  initDatabase
129
129
  } from "./chunk-BLNFJ22S.js";
@@ -5479,7 +5479,7 @@ function createTerminalRoutes() {
5479
5479
  }
5480
5480
 
5481
5481
  // src/constants.ts
5482
- var VERSION = "1.6.39";
5482
+ var VERSION = "1.6.40";
5483
5483
 
5484
5484
  // src/server/index.ts
5485
5485
  var __dirname2 = dirname5(fileURLToPath4(import.meta.url));
@@ -5781,7 +5781,7 @@ async function createServerHandle(config) {
5781
5781
  if (!callId || approved === void 0) {
5782
5782
  return res.status(400).json({ error: "callId and approved are required" });
5783
5783
  }
5784
- const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-6XOZHTF7.js");
5784
+ const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-EVB6JNKF.js");
5785
5785
  const result = providePathConfirmation2(callId, approved, alwaysAllow);
5786
5786
  if (!result.found) {
5787
5787
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
@@ -5806,7 +5806,7 @@ async function createServerHandle(config) {
5806
5806
  if (!callId || !answer) {
5807
5807
  return res.status(400).json({ error: "callId and answer are required" });
5808
5808
  }
5809
- const { provideAnswer: provideAnswer2 } = await import("./tools-6XOZHTF7.js");
5809
+ const { provideAnswer: provideAnswer2 } = await import("./tools-EVB6JNKF.js");
5810
5810
  const found = provideAnswer2(callId, answer);
5811
5811
  if (!found) {
5812
5812
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -5842,8 +5842,8 @@ async function createServerHandle(config) {
5842
5842
  if (!session) {
5843
5843
  return res.status(404).json({ error: "Session not found" });
5844
5844
  }
5845
- const { stopSessionExecution } = await import("./chat-handler-7ARMDWRH.js");
5846
- const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-6XOZHTF7.js");
5845
+ const { stopSessionExecution } = await import("./chat-handler-TJWYGO3G.js");
5846
+ const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-EVB6JNKF.js");
5847
5847
  stopSessionExecution(sessionId, sessionManager);
5848
5848
  abortSession(sessionId);
5849
5849
  cancelQuestionsForSession2(sessionId, "Session stopped by user");
@@ -6302,7 +6302,7 @@ async function createServerHandle(config) {
6302
6302
  providerManager
6303
6303
  );
6304
6304
  const wss = wssExports.wss;
6305
- const { QueueProcessor } = await import("./processor-KR5GNW3S.js");
6305
+ const { QueueProcessor } = await import("./processor-ISY5OU5E.js");
6306
6306
  const queueProcessor = new QueueProcessor({
6307
6307
  sessionManager,
6308
6308
  providerManager,
@@ -6375,4 +6375,4 @@ export {
6375
6375
  createServerHandle,
6376
6376
  createServer
6377
6377
  };
6378
- //# sourceMappingURL=chunk-2XRQ55GT.js.map
6378
+ //# sourceMappingURL=chunk-FBB4JVTK.js.map
@@ -1,5 +1,6 @@
1
1
  // src/cli/main.ts
2
2
  import { parseArgs } from "util";
3
+ import { spawnSync } from "child_process";
3
4
  import { select, password, isCancel, cancel } from "@clack/prompts";
4
5
  import { generateKeyPairSync } from "crypto";
5
6
  import { writeFile } from "fs/promises";
@@ -17,6 +18,8 @@ Commands:
17
18
  provider list List configured providers
18
19
  provider use Switch active provider
19
20
  provider remove Remove a provider
21
+ service Manage the systemd service (install, start, stop, status, logs, uninstall)
22
+ update Update OpenFox to the latest version (see update.sh)
20
23
 
21
24
  Options:
22
25
  -p, --port <number> Specify port (default: 10369 for prod, 10469 for dev)
@@ -121,11 +124,8 @@ async function runCli(options) {
121
124
  allowPositionals: true,
122
125
  strict: true
123
126
  });
124
- if (values.help) {
125
- printHelp();
126
- process.exit(0);
127
- }
128
- if (values.version) {
127
+ const [command] = positionals;
128
+ if (values.version && !command) {
129
129
  const { readFileSync } = await import("fs");
130
130
  const { fileURLToPath } = await import("url");
131
131
  const { dirname, join } = await import("path");
@@ -136,7 +136,10 @@ async function runCli(options) {
136
136
  console.log(packageJson.version);
137
137
  process.exit(0);
138
138
  }
139
- const [command] = positionals;
139
+ if (values.help && !command) {
140
+ printHelp();
141
+ process.exit(0);
142
+ }
140
143
  switch (command) {
141
144
  case "config": {
142
145
  await runConfig(mode);
@@ -148,13 +151,30 @@ async function runCli(options) {
148
151
  await runProviderCommand(mode, subcommand);
149
152
  break;
150
153
  }
154
+ case "service": {
155
+ const { runServiceCommand } = await import("./service-74Z7JK2J.js");
156
+ const [, subcommand] = positionals;
157
+ if (subcommand === "--help" || subcommand === "-h" || values.help) {
158
+ runServiceCommand(mode, void 0);
159
+ } else {
160
+ await runServiceCommand(mode, subcommand);
161
+ }
162
+ break;
163
+ }
164
+ case "update": {
165
+ const result = spawnSync("./update.sh", [], { shell: true, stdio: "inherit" });
166
+ if (result.status !== 0) {
167
+ process.exit(result.status ?? 1);
168
+ }
169
+ break;
170
+ }
151
171
  default: {
152
172
  const { configFileExists } = await import("./config-ACVEHBKG.js");
153
173
  const configExists = await configFileExists(mode);
154
174
  if (!configExists) {
155
175
  await runNetworkSetup(mode);
156
176
  }
157
- const { runServe } = await import("./serve-VYIJRI5T.js");
177
+ const { runServe } = await import("./serve-H4VVKZCI.js");
158
178
  await runServe({
159
179
  mode,
160
180
  port: values.port ? parseInt(values.port) : void 0,
@@ -167,4 +187,4 @@ async function runCli(options) {
167
187
  export {
168
188
  runCli
169
189
  };
170
- //# sourceMappingURL=chunk-SHQZ2M6R.js.map
190
+ //# sourceMappingURL=chunk-JUFRVZMV.js.map
@@ -11,6 +11,9 @@ import {
11
11
  getMaxPerSession,
12
12
  getSessionProcessCount
13
13
  } from "./chunk-574HZVLE.js";
14
+ import {
15
+ getProject
16
+ } from "./chunk-7JPKRM6M.js";
14
17
  import {
15
18
  buildModelParams,
16
19
  getBackendCapabilities,
@@ -41,9 +44,6 @@ import {
41
44
  getSetting,
42
45
  setSetting
43
46
  } from "./chunk-O2BOWZKC.js";
44
- import {
45
- getProject
46
- } from "./chunk-7JPKRM6M.js";
47
47
  import {
48
48
  getGlobalConfigDir
49
49
  } from "./chunk-R4HADRYO.js";
@@ -3351,7 +3351,7 @@ var callSubAgentTool = {
3351
3351
  };
3352
3352
  }
3353
3353
  try {
3354
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-6XOZHTF7.js");
3354
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-EVB6JNKF.js");
3355
3355
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3356
3356
  const turnMetrics = new TurnMetrics();
3357
3357
  const result = await executeSubAgent({
@@ -4480,4 +4480,4 @@ export {
4480
4480
  getToolRegistryForAgent,
4481
4481
  createToolRegistry
4482
4482
  };
4483
- //# sourceMappingURL=chunk-5NJ5NQH5.js.map
4483
+ //# sourceMappingURL=chunk-QFOT3J6I.js.map
@@ -13,7 +13,7 @@ import {
13
13
  getToolRegistryForAgent,
14
14
  loadAllAgentsDefault,
15
15
  runTopLevelAgentLoop
16
- } from "./chunk-5NJ5NQH5.js";
16
+ } from "./chunk-QFOT3J6I.js";
17
17
  import {
18
18
  getCurrentContextWindowId,
19
19
  getEventStore
@@ -293,4 +293,4 @@ export {
293
293
  runBuilderTurn,
294
294
  runVerifierTurn
295
295
  };
296
- //# sourceMappingURL=chunk-TBSTW3PW.js.map
296
+ //# sourceMappingURL=chunk-VCVHYZZS.js.map
package/dist/cli/dev.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-SHQZ2M6R.js";
4
+ } from "../chunk-JUFRVZMV.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-PNBH3RAX.js";
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-SHQZ2M6R.js";
4
+ } from "../chunk-JUFRVZMV.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-PNBH3RAX.js";
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ OLD_VERSION=$(openfox --version)
5
+ openfox service stop
6
+ npm cache clean --force
7
+ npm update -g openfox
8
+ NEW_VERSION=$(openfox --version)
9
+ openfox service start
10
+ echo "Updated: $OLD_VERSION -> $NEW_VERSION"
@@ -3,7 +3,7 @@ import {
3
3
  runBuilderTurn,
4
4
  runChatTurn,
5
5
  runVerifierTurn
6
- } from "./chunk-TBSTW3PW.js";
6
+ } from "./chunk-VCVHYZZS.js";
7
7
  import {
8
8
  TurnMetrics,
9
9
  createChatDoneEvent,
@@ -11,16 +11,16 @@ import {
11
11
  createMessageStartEvent,
12
12
  createToolCallEvent,
13
13
  createToolResultEvent
14
- } from "./chunk-5NJ5NQH5.js";
14
+ } from "./chunk-QFOT3J6I.js";
15
15
  import "./chunk-NBU6KIOD.js";
16
16
  import "./chunk-574HZVLE.js";
17
+ import "./chunk-7JPKRM6M.js";
17
18
  import "./chunk-D4ZLSV6P.js";
18
19
  import "./chunk-YVQ6DP5Y.js";
19
20
  import "./chunk-LIMBYVO4.js";
20
21
  import "./chunk-DZHZ3UUR.js";
21
22
  import "./chunk-22CTURMH.js";
22
23
  import "./chunk-O2BOWZKC.js";
23
- import "./chunk-7JPKRM6M.js";
24
24
  import "./chunk-BLNFJ22S.js";
25
25
  import "./chunk-Y6HBEACI.js";
26
26
  import "./chunk-R4HADRYO.js";
@@ -39,4 +39,4 @@ export {
39
39
  runChatTurn,
40
40
  runVerifierTurn
41
41
  };
42
- //# sourceMappingURL=orchestrator-FKVRAIIA.js.map
42
+ //# sourceMappingURL=orchestrator-M2XGDN3F.js.map
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfox",
3
- "version": "1.6.39",
3
+ "version": "1.6.40",
4
4
  "description": "Local-LLM-first agentic coding assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "dev": "OPENFOX_DEV=true tsx watch src/cli/dev.ts --no-browser",
28
28
  "dev:web": "vite --config web/vite.config.ts",
29
29
  "build": "FORCE_COLOR=1 npm run build:server && FORCE_COLOR=1 npm run build:web",
30
- "build:server": "FORCE_COLOR=1 tsup && mkdir -p dist/command-defaults dist/skill-defaults dist/agent-defaults dist/workflow-defaults && cp src/server/commands/defaults/*.md dist/command-defaults/ && cp src/server/skills/defaults/*.md dist/skill-defaults/ && cp src/server/agents/defaults/*.md dist/agent-defaults/ && cp src/server/workflows/defaults/*.json dist/workflow-defaults/ && cp package.json dist/",
30
+ "build:server": "FORCE_COLOR=1 tsup && mkdir -p dist/command-defaults dist/skill-defaults dist/agent-defaults dist/workflow-defaults && cp src/server/commands/defaults/*.md dist/command-defaults/ && cp src/server/skills/defaults/*.md dist/skill-defaults/ && cp src/server/agents/defaults/*.md dist/agent-defaults/ && cp src/server/workflows/defaults/*.json dist/workflow-defaults/ && cp src/cli/update.sh dist/cli/ && chmod +x dist/cli/update.sh && cp package.json dist/",
31
31
  "build:web": "cd web && FORCE_COLOR=1 vite build --outDir ../dist/web",
32
32
  "start": "node dist/cli/index.js",
33
33
  "start:dev": "node dist/cli/dev.js",
@@ -175,7 +175,7 @@ var QueueProcessor = class {
175
175
  backend: provider?.backend ?? llmClient.getBackend(),
176
176
  model: llmClient.getModel()
177
177
  };
178
- const { runChatTurn } = await import("./orchestrator-FKVRAIIA.js");
178
+ const { runChatTurn } = await import("./orchestrator-M2XGDN3F.js");
179
179
  const runChatTurnParams = buildRunChatTurnParams({
180
180
  sessionManager,
181
181
  sessionId,
@@ -208,4 +208,4 @@ var QueueProcessor = class {
208
208
  export {
209
209
  QueueProcessor
210
210
  };
211
- //# sourceMappingURL=processor-KR5GNW3S.js.map
211
+ //# sourceMappingURL=processor-ISY5OU5E.js.map
@@ -6,12 +6,13 @@ import {
6
6
  import {
7
7
  VERSION,
8
8
  createServer
9
- } from "./chunk-2XRQ55GT.js";
9
+ } from "./chunk-FBB4JVTK.js";
10
10
  import "./chunk-BHSTSA7U.js";
11
- import "./chunk-TBSTW3PW.js";
12
- import "./chunk-5NJ5NQH5.js";
11
+ import "./chunk-VCVHYZZS.js";
12
+ import "./chunk-QFOT3J6I.js";
13
13
  import "./chunk-NBU6KIOD.js";
14
14
  import "./chunk-574HZVLE.js";
15
+ import "./chunk-7JPKRM6M.js";
15
16
  import "./chunk-PYBB34ZK.js";
16
17
  import "./chunk-KSASIV4B.js";
17
18
  import "./chunk-D4ZLSV6P.js";
@@ -20,7 +21,6 @@ import "./chunk-LIMBYVO4.js";
20
21
  import "./chunk-DZHZ3UUR.js";
21
22
  import "./chunk-22CTURMH.js";
22
23
  import "./chunk-O2BOWZKC.js";
23
- import "./chunk-7JPKRM6M.js";
24
24
  import "./chunk-BLNFJ22S.js";
25
25
  import "./chunk-B7E3BICY.js";
26
26
  import "./chunk-Y6HBEACI.js";
@@ -188,4 +188,4 @@ async function runServe(options) {
188
188
  export {
189
189
  runServe
190
190
  };
191
- //# sourceMappingURL=serve-VYIJRI5T.js.map
191
+ //# sourceMappingURL=serve-H4VVKZCI.js.map
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  createServer,
3
3
  createServerHandle
4
- } from "../chunk-2XRQ55GT.js";
4
+ } from "../chunk-FBB4JVTK.js";
5
5
  import "../chunk-BHSTSA7U.js";
6
- import "../chunk-TBSTW3PW.js";
7
- import "../chunk-5NJ5NQH5.js";
6
+ import "../chunk-VCVHYZZS.js";
7
+ import "../chunk-QFOT3J6I.js";
8
8
  import "../chunk-NBU6KIOD.js";
9
9
  import "../chunk-574HZVLE.js";
10
+ import "../chunk-7JPKRM6M.js";
10
11
  import "../chunk-PYBB34ZK.js";
11
12
  import "../chunk-KSASIV4B.js";
12
13
  import "../chunk-D4ZLSV6P.js";
@@ -15,7 +16,6 @@ import "../chunk-LIMBYVO4.js";
15
16
  import "../chunk-DZHZ3UUR.js";
16
17
  import "../chunk-22CTURMH.js";
17
18
  import "../chunk-O2BOWZKC.js";
18
- import "../chunk-7JPKRM6M.js";
19
19
  import "../chunk-BLNFJ22S.js";
20
20
  import "../chunk-B7E3BICY.js";
21
21
  import "../chunk-Y6HBEACI.js";
@@ -0,0 +1,228 @@
1
+ // src/cli/service.ts
2
+ import { spawn, spawnSync } from "child_process";
3
+ import { mkdir, writeFile, rm, access, constants } from "fs/promises";
4
+ import { join } from "path";
5
+ import { homedir } from "os";
6
+ var RUN_SCRIPT_PATH = "~/.local/state/openfox/bin/run.sh";
7
+ var SERVICE_PATH = "~/.config/systemd/user/openfox.service";
8
+ var SERVICE_NAME = "openfox";
9
+ function expandPath(path) {
10
+ if (path.startsWith("~/")) {
11
+ return join(homedir(), path.slice(2));
12
+ }
13
+ return path;
14
+ }
15
+ async function pathExists(path) {
16
+ try {
17
+ await access(expandPath(path), constants.F_OK);
18
+ return true;
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+ function systemctl(args, silent = false) {
24
+ const result = spawnSync("systemctl", ["--user", ...args], {
25
+ encoding: "utf-8"
26
+ });
27
+ if (!silent) {
28
+ console.log(result.stdout || result.stderr || "");
29
+ }
30
+ return { success: result.status === 0, output: result.stdout + result.stderr };
31
+ }
32
+ function exec(command, args = []) {
33
+ return new Promise((resolve, reject) => {
34
+ const child = spawn(command, args, { stdio: "inherit" });
35
+ child.on("exit", (code) => {
36
+ if (code === 0) resolve();
37
+ else reject(new Error(`Command failed: ${command} ${args.join(" ")}`));
38
+ });
39
+ child.on("error", reject);
40
+ });
41
+ }
42
+ async function createWrapperScript() {
43
+ const binDir = expandPath("~/.local/state/openfox/bin");
44
+ await mkdir(binDir, { recursive: true });
45
+ const scriptPath = expandPath(RUN_SCRIPT_PATH);
46
+ const scriptContent = `#!/bin/bash
47
+ source ~/.bashrc
48
+ exec openfox
49
+ `;
50
+ await writeFile(scriptPath, scriptContent, { encoding: "utf-8" });
51
+ await exec("chmod", ["+x", scriptPath]);
52
+ console.log(`Created: ${scriptPath}`);
53
+ }
54
+ async function createSystemdService() {
55
+ const serviceDir = expandPath("~/.config/systemd/user");
56
+ await mkdir(serviceDir, { recursive: true });
57
+ const servicePath = expandPath(SERVICE_PATH);
58
+ const serviceContent = `[Unit]
59
+ Description=OpenFox Agentic Coding Assistant
60
+
61
+ [Service]
62
+ Type=simple
63
+ ExecStart=${expandPath(RUN_SCRIPT_PATH)}
64
+ Restart=always
65
+ RestartSec=5
66
+
67
+ [Install]
68
+ WantedBy=default.target
69
+ `;
70
+ await writeFile(servicePath, serviceContent, "utf-8");
71
+ console.log(`Created: ${servicePath}`);
72
+ }
73
+ async function runServiceCommand(_mode, subcommand) {
74
+ if (!subcommand) {
75
+ printServiceHelp();
76
+ return;
77
+ }
78
+ switch (subcommand) {
79
+ case "install":
80
+ await serviceInstall();
81
+ break;
82
+ case "start":
83
+ await serviceStart();
84
+ break;
85
+ case "stop":
86
+ await serviceStop();
87
+ break;
88
+ case "restart":
89
+ await serviceRestart();
90
+ break;
91
+ case "status":
92
+ await serviceStatus();
93
+ break;
94
+ case "logs":
95
+ await serviceLogs();
96
+ break;
97
+ case "uninstall":
98
+ await serviceUninstall();
99
+ break;
100
+ default:
101
+ console.error(`Unknown subcommand: ${subcommand}`);
102
+ printServiceHelp();
103
+ process.exit(1);
104
+ }
105
+ }
106
+ function printServiceHelp() {
107
+ console.log(`
108
+ OpenFox Service Management
109
+
110
+ Usage:
111
+ openfox service <command>
112
+
113
+ Commands:
114
+ install Install and enable the systemd service
115
+ start Start the service (if installed)
116
+ stop Stop the service (if installed)
117
+ restart Restart the service (if installed)
118
+ status Show service status
119
+ logs Show recent service logs
120
+ uninstall Disable and remove the service files
121
+ `);
122
+ }
123
+ async function serviceInstall() {
124
+ console.log("Installing OpenFox service...\n");
125
+ const installed = await pathExists(SERVICE_PATH);
126
+ if (installed) {
127
+ const { success } = systemctl(["is-active", SERVICE_NAME], true);
128
+ if (success) {
129
+ console.log("Service is already installed and running.");
130
+ return;
131
+ }
132
+ console.log("Service files exist. Reinstalling...");
133
+ await serviceUninstall();
134
+ }
135
+ await createWrapperScript();
136
+ await createSystemdService();
137
+ systemctl(["daemon-reload"]);
138
+ systemctl(["enable", SERVICE_NAME]);
139
+ systemctl(["start", SERVICE_NAME]);
140
+ console.log("\n\u2713 Service installed and started");
141
+ }
142
+ async function serviceStart() {
143
+ const installed = await pathExists(SERVICE_PATH);
144
+ if (!installed) {
145
+ console.log('Service not installed. Run "openfox service install" first.');
146
+ return;
147
+ }
148
+ const { success } = systemctl(["is-active", SERVICE_NAME], true);
149
+ if (success) {
150
+ console.log("Service is already running.");
151
+ return;
152
+ }
153
+ systemctl(["start", SERVICE_NAME]);
154
+ console.log("\u2713 Service started");
155
+ }
156
+ async function serviceStop() {
157
+ const installed = await pathExists(SERVICE_PATH);
158
+ if (!installed) {
159
+ console.log("Service not installed.");
160
+ return;
161
+ }
162
+ const { success } = systemctl(["is-active", SERVICE_NAME], true);
163
+ if (!success) {
164
+ console.log("Service is not running.");
165
+ return;
166
+ }
167
+ systemctl(["stop", SERVICE_NAME]);
168
+ console.log("\u2713 Service stopped");
169
+ }
170
+ async function serviceRestart() {
171
+ const installed = await pathExists(SERVICE_PATH);
172
+ if (!installed) {
173
+ console.log("Service not installed.");
174
+ return;
175
+ }
176
+ systemctl(["restart", SERVICE_NAME]);
177
+ console.log("\u2713 Service restarted");
178
+ }
179
+ async function serviceStatus() {
180
+ const installed = await pathExists(SERVICE_PATH);
181
+ if (!installed) {
182
+ console.log("Service: not installed");
183
+ return;
184
+ }
185
+ console.log("Service: installed");
186
+ systemctl(["is-active", SERVICE_NAME], false);
187
+ systemctl(["is-enabled", SERVICE_NAME], false);
188
+ }
189
+ async function serviceLogs() {
190
+ const installed = await pathExists(SERVICE_PATH);
191
+ if (!installed) {
192
+ console.log("Service not installed.");
193
+ return;
194
+ }
195
+ const result = spawnSync("journalctl", ["--user", "-u", SERVICE_NAME, "-n", "50", "--no-pager"], {
196
+ encoding: "utf-8"
197
+ });
198
+ console.log(result.stdout || result.stderr || "No logs");
199
+ }
200
+ async function serviceUninstall() {
201
+ console.log("Uninstalling OpenFox service...\n");
202
+ const installed = await pathExists(SERVICE_PATH);
203
+ if (!installed) {
204
+ console.log("Service not installed.");
205
+ return;
206
+ }
207
+ const { success } = systemctl(["is-active", SERVICE_NAME], true);
208
+ if (success) {
209
+ systemctl(["stop", SERVICE_NAME]);
210
+ }
211
+ systemctl(["disable", SERVICE_NAME]);
212
+ try {
213
+ await rm(expandPath(SERVICE_PATH));
214
+ console.log(`Removed: ${expandPath(SERVICE_PATH)}`);
215
+ } catch {
216
+ }
217
+ try {
218
+ await rm(expandPath(RUN_SCRIPT_PATH));
219
+ console.log(`Removed: ${expandPath(RUN_SCRIPT_PATH)}`);
220
+ } catch {
221
+ }
222
+ systemctl(["daemon-reload"]);
223
+ console.log("\n\u2713 Service uninstalled");
224
+ }
225
+ export {
226
+ runServiceCommand
227
+ };
228
+ //# sourceMappingURL=service-74Z7JK2J.js.map
@@ -11,9 +11,10 @@ import {
11
11
  requestPathAccess,
12
12
  stepDoneTool,
13
13
  validateToolAction
14
- } from "./chunk-5NJ5NQH5.js";
14
+ } from "./chunk-QFOT3J6I.js";
15
15
  import "./chunk-NBU6KIOD.js";
16
16
  import "./chunk-574HZVLE.js";
17
+ import "./chunk-7JPKRM6M.js";
17
18
  import "./chunk-D4ZLSV6P.js";
18
19
  import "./chunk-YVQ6DP5Y.js";
19
20
  import "./chunk-LIMBYVO4.js";
@@ -24,7 +25,6 @@ import {
24
25
  provideAnswer
25
26
  } from "./chunk-22CTURMH.js";
26
27
  import "./chunk-O2BOWZKC.js";
27
- import "./chunk-7JPKRM6M.js";
28
28
  import "./chunk-BLNFJ22S.js";
29
29
  import "./chunk-Y6HBEACI.js";
30
30
  import "./chunk-R4HADRYO.js";
@@ -48,4 +48,4 @@ export {
48
48
  stepDoneTool,
49
49
  validateToolAction
50
50
  };
51
- //# sourceMappingURL=tools-6XOZHTF7.js.map
51
+ //# sourceMappingURL=tools-EVB6JNKF.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfox",
3
- "version": "1.6.39",
3
+ "version": "1.6.40",
4
4
  "description": "Local-LLM-first agentic coding assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "dev": "OPENFOX_DEV=true tsx watch src/cli/dev.ts --no-browser",
28
28
  "dev:web": "vite --config web/vite.config.ts",
29
29
  "build": "FORCE_COLOR=1 npm run build:server && FORCE_COLOR=1 npm run build:web",
30
- "build:server": "FORCE_COLOR=1 tsup && mkdir -p dist/command-defaults dist/skill-defaults dist/agent-defaults dist/workflow-defaults && cp src/server/commands/defaults/*.md dist/command-defaults/ && cp src/server/skills/defaults/*.md dist/skill-defaults/ && cp src/server/agents/defaults/*.md dist/agent-defaults/ && cp src/server/workflows/defaults/*.json dist/workflow-defaults/ && cp package.json dist/",
30
+ "build:server": "FORCE_COLOR=1 tsup && mkdir -p dist/command-defaults dist/skill-defaults dist/agent-defaults dist/workflow-defaults && cp src/server/commands/defaults/*.md dist/command-defaults/ && cp src/server/skills/defaults/*.md dist/skill-defaults/ && cp src/server/agents/defaults/*.md dist/agent-defaults/ && cp src/server/workflows/defaults/*.json dist/workflow-defaults/ && cp src/cli/update.sh dist/cli/ && chmod +x dist/cli/update.sh && cp package.json dist/",
31
31
  "build:web": "cd web && FORCE_COLOR=1 vite build --outDir ../dist/web",
32
32
  "start": "node dist/cli/index.js",
33
33
  "start:dev": "node dist/cli/dev.js",