openfox 1.6.14 → 1.6.15

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.
Files changed (39) hide show
  1. package/dist/{auto-compaction-C4PMBB24.js → auto-compaction-JZIM73ZY.js} +5 -5
  2. package/dist/{chat-handler-US3QOOE4.js → chat-handler-F2A2IMQB.js} +26 -56
  3. package/dist/{chunk-7HLRI6JM.js → chunk-2KP34IDL.js} +161 -204
  4. package/dist/{chunk-N25QUEPO.js → chunk-3WHZ47PY.js} +506 -786
  5. package/dist/{chunk-XFXOSPYH.js → chunk-55N6FAAZ.js} +1 -1
  6. package/dist/{chunk-5GE3QJSZ.js → chunk-6L3X7T4K.js} +82 -160
  7. package/dist/{chunk-QDEKU5RL.js → chunk-F54ZJN4X.js} +38 -2
  8. package/dist/{chunk-3JU6H6A4.js → chunk-G4E72ST3.js} +116 -241
  9. package/dist/{chunk-UL4JYQKK.js → chunk-IN5EP4ZB.js} +2 -2
  10. package/dist/{chunk-PCOG5FQD.js → chunk-JFKYCGZ5.js} +6 -6
  11. package/dist/{chunk-OOIRCXAY.js → chunk-KOUMYBYM.js} +53 -112
  12. package/dist/{chunk-3XZ23PXM.js → chunk-OVLFEBRR.js} +76 -92
  13. package/dist/chunk-SN7OBEVL.js +44 -0
  14. package/dist/{chunk-H22VHHQ4.js → chunk-YM6VHAPM.js} +4 -4
  15. package/dist/{chunk-J2DHVXRX.js → chunk-ZDNXCVW4.js} +2 -2
  16. package/dist/cli/dev.js +1 -1
  17. package/dist/cli/index.js +1 -1
  18. package/dist/{config-DEM6ASQM.js → config-67AX6CNS.js} +5 -5
  19. package/dist/{events-VDAC7E7K.js → events-2ETDOE5B.js} +3 -3
  20. package/dist/{folding-NDFQCISZ.js → folding-M7FMUBOL.js} +6 -4
  21. package/dist/{orchestrator-KZI7B5IS.js → orchestrator-SRSG2SIZ.js} +6 -6
  22. package/dist/package.json +13 -3
  23. package/dist/{processor-KBSF2HFD.js → processor-H5BQ5HQM.js} +24 -49
  24. package/dist/{provider-K3PHZO27.js → provider-DKGBQHUS.js} +7 -7
  25. package/dist/{serve-DERN4AB6.js → serve-5AY7GMN7.js} +12 -12
  26. package/dist/server/index.d.ts +2 -0
  27. package/dist/server/index.js +10 -10
  28. package/dist/{tools-PLVK22CF.js → tools-VOWNOP6V.js} +5 -5
  29. package/dist/{vision-fallback-NOC3YYIB.js → vision-fallback-ADYRFFD4.js} +2 -2
  30. package/dist/web/assets/{index-MCWDS5UQ.css → index-CNeIjdxm.css} +1 -1
  31. package/dist/web/assets/index-mBLhctLW.js +150 -0
  32. package/dist/web/index.html +2 -2
  33. package/dist/web/sw.js +1 -1
  34. package/package.json +13 -3
  35. package/dist/web/assets/index-Ccy2Csbl.js +0 -150
  36. /package/dist/{command-defaults → server/commands/defaults}/commit-push.command.md +0 -0
  37. /package/dist/{command-defaults → server/commands/defaults}/init.command.md +0 -0
  38. /package/dist/{command-defaults → server/commands/defaults}/test-ui.command.md +0 -0
  39. /package/dist/{skill-defaults → server/skills/defaults}/browser.skill.md +0 -0
@@ -1,30 +1,38 @@
1
1
  import {
2
2
  generateSessionName,
3
3
  needsNameGeneration
4
- } from "./chunk-QDEKU5RL.js";
4
+ } from "./chunk-F54ZJN4X.js";
5
5
  import {
6
6
  createVerifierNudgeConfig,
7
7
  runBuilderTurn,
8
8
  runChatTurn
9
- } from "./chunk-H22VHHQ4.js";
9
+ } from "./chunk-YM6VHAPM.js";
10
10
  import {
11
11
  TurnMetrics,
12
12
  agentExists,
13
13
  assembleAgentRequest,
14
14
  cancelPathConfirmationsForSession,
15
+ checkAborted,
15
16
  createChatDoneEvent,
16
17
  createMessageStartEvent,
17
18
  createToolRegistry,
18
19
  deleteAgent,
20
+ deleteItem,
19
21
  deleteSkill,
20
22
  devServerManager,
23
+ dirExists,
21
24
  ensureDefaultAgents,
22
25
  ensureDefaultSkills,
26
+ ensureDir,
23
27
  executeSubAgent,
24
28
  findAgentById,
29
+ findById,
30
+ findModifiedDefaultFiles,
25
31
  findSkillById,
26
32
  getAllInstructions,
33
+ getBundleDir,
27
34
  getDefaultAgentIds,
35
+ getDefaultIds,
28
36
  getDefaultSkillIds,
29
37
  getEnabledSkillMetadata,
30
38
  getModifiedDefaultAgentIds,
@@ -34,17 +42,21 @@ import {
34
42
  loadAllAgents,
35
43
  loadAllAgentsDefault,
36
44
  loadAllSkills,
45
+ loadItems,
37
46
  maybeAutoCompactContext,
38
47
  performManualContextCompaction,
39
48
  restoreAllDefaultAgents,
40
49
  restoreAllDefaultSkills,
50
+ restoreDefault,
41
51
  restoreDefaultAgent,
42
52
  restoreDefaultSkill,
43
53
  saveAgent,
54
+ saveItem,
44
55
  saveSkill,
45
56
  setSkillEnabled,
46
- skillExists
47
- } from "./chunk-N25QUEPO.js";
57
+ skillExists,
58
+ spawnShellProcess
59
+ } from "./chunk-3WHZ47PY.js";
48
60
  import {
49
61
  getPathSeparator,
50
62
  getPlatformShell,
@@ -54,7 +66,7 @@ import {
54
66
  import {
55
67
  createProviderManager,
56
68
  parseDefaultModelSelection
57
- } from "./chunk-OOIRCXAY.js";
69
+ } from "./chunk-KOUMYBYM.js";
58
70
  import {
59
71
  SessionNotFoundError,
60
72
  createLLMClient,
@@ -63,7 +75,7 @@ import {
63
75
  getBackendDisplayName,
64
76
  getLlmStatus,
65
77
  getModelProfile
66
- } from "./chunk-3XZ23PXM.js";
78
+ } from "./chunk-OVLFEBRR.js";
67
79
  import {
68
80
  createSession,
69
81
  deleteSession,
@@ -89,12 +101,12 @@ import {
89
101
  updateSessionProvider,
90
102
  updateSessionRunning,
91
103
  updateSessionSummary
92
- } from "./chunk-5GE3QJSZ.js";
104
+ } from "./chunk-6L3X7T4K.js";
93
105
  import {
94
106
  buildContextMessagesFromEventHistory,
95
107
  buildMessagesFromStoredEvents,
96
108
  foldPendingConfirmations
97
- } from "./chunk-7HLRI6JM.js";
109
+ } from "./chunk-2KP34IDL.js";
98
110
  import {
99
111
  createChatErrorMessage,
100
112
  createChatMessageMessage,
@@ -144,9 +156,9 @@ import {
144
156
  import express from "express";
145
157
  import cors from "cors";
146
158
  import { createServer as createHttpServer } from "http";
147
- import { fileURLToPath as fileURLToPath4 } from "url";
148
- import { dirname as dirname5, resolve, join as join5 } from "path";
149
- import { readFile as readFile4 } from "fs/promises";
159
+ import { fileURLToPath as fileURLToPath3 } from "url";
160
+ import { dirname as dirname4, resolve, join as join5 } from "path";
161
+ import { readFile as readFile3 } from "fs/promises";
150
162
  import { createServer as createViteServer } from "vite";
151
163
 
152
164
  // src/server/llm/mock.ts
@@ -1511,29 +1523,12 @@ async function restoreDefaultWorkflow(configDir, workflowId) {
1511
1523
  return false;
1512
1524
  }
1513
1525
  async function getModifiedDefaultWorkflowIds(configDir) {
1514
- const defaultIds = await getDefaultWorkflowIds();
1515
- const modified = [];
1516
- for (const id of defaultIds) {
1517
- const filename = `${id}${WORKFLOW_EXTENSION}`;
1518
- const userPath = join(getWorkflowsDir(configDir), filename);
1519
- let bundledContent = null;
1520
- for (const dir of [DEFAULTS_DIR, DEFAULTS_DIR_ALT]) {
1521
- try {
1522
- bundledContent = await readFile(join(dir, filename), "utf-8");
1523
- break;
1524
- } catch {
1525
- }
1526
- }
1527
- if (!bundledContent) continue;
1528
- try {
1529
- const userContent = await readFile(userPath, "utf-8");
1530
- if (userContent !== bundledContent) {
1531
- modified.push(id);
1532
- }
1533
- } catch {
1534
- }
1535
- }
1536
- return modified;
1526
+ return findModifiedDefaultFiles(
1527
+ await getDefaultWorkflowIds(),
1528
+ WORKFLOW_EXTENSION,
1529
+ [DEFAULTS_DIR, DEFAULTS_DIR_ALT],
1530
+ getWorkflowsDir(configDir)
1531
+ );
1537
1532
  }
1538
1533
  async function restoreAllDefaultWorkflows(configDir) {
1539
1534
  const ids = await getDefaultWorkflowIds();
@@ -1579,19 +1574,13 @@ var TERMINAL_DONE = "$done";
1579
1574
  var TERMINAL_BLOCKED = "$blocked";
1580
1575
 
1581
1576
  // src/server/workflows/shell.ts
1582
- import { spawn as spawn2 } from "child_process";
1583
1577
  function executeShellCommand(command, cwd, timeout, signal) {
1584
1578
  return new Promise((resolve2, reject) => {
1585
- if (signal?.aborted) {
1579
+ if (checkAborted(signal)) {
1586
1580
  reject(new Error("Aborted"));
1587
1581
  return;
1588
1582
  }
1589
- const shell = getPlatformShell();
1590
- const proc = spawn2(shell.command, [...shell.args, command], {
1591
- cwd,
1592
- env: { ...process.env, FORCE_COLOR: "0" },
1593
- stdio: ["ignore", "pipe", "pipe"]
1594
- });
1583
+ const proc = spawnShellProcess(command, cwd, signal);
1595
1584
  let stdout = "";
1596
1585
  let stderr = "";
1597
1586
  let killed = false;
@@ -1609,10 +1598,10 @@ function executeShellCommand(command, cwd, timeout, signal) {
1609
1598
  }
1610
1599
  };
1611
1600
  signal?.addEventListener("abort", onAbort);
1612
- proc.stdout.on("data", (data) => {
1601
+ proc.stdout?.on("data", (data) => {
1613
1602
  stdout += data.toString();
1614
1603
  });
1615
- proc.stderr.on("data", (data) => {
1604
+ proc.stderr?.on("data", (data) => {
1616
1605
  stderr += data.toString();
1617
1606
  });
1618
1607
  proc.on("close", (code) => {
@@ -1694,6 +1683,28 @@ function evaluateTransitions(transitions, criteria, stepOutcome) {
1694
1683
  }
1695
1684
  return TERMINAL_BLOCKED;
1696
1685
  }
1686
+ function emitWorkflowMessage(eventStore, sessionId, content, windowOptions, onMessage) {
1687
+ const msgId = crypto.randomUUID();
1688
+ eventStore.append(sessionId, createMessageStartEvent(msgId, "user", content, {
1689
+ ...windowOptions ?? {},
1690
+ isSystemGenerated: true,
1691
+ messageKind: "correction",
1692
+ metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
1693
+ }));
1694
+ eventStore.append(sessionId, { type: "message.done", data: { messageId: msgId } });
1695
+ if (onMessage) {
1696
+ onMessage(createChatMessageMessage({
1697
+ id: msgId,
1698
+ role: "user",
1699
+ content,
1700
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1701
+ isSystemGenerated: true,
1702
+ messageKind: "correction",
1703
+ metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
1704
+ }));
1705
+ }
1706
+ return msgId;
1707
+ }
1697
1708
  function getCurrentWindowMessageOptions(sessionId) {
1698
1709
  const contextWindowId = getCurrentContextWindowId(sessionId);
1699
1710
  return contextWindowId ? { contextWindowId } : void 0;
@@ -1823,25 +1834,7 @@ async function executeWorkflow(workflow, options) {
1823
1834
  }
1824
1835
  parts.push(STEP_DONE_NUDGE);
1825
1836
  nudgeContent = parts.join("\n\n");
1826
- const nudgeMsgId = crypto.randomUUID();
1827
- eventStore.append(sessionId, createMessageStartEvent(nudgeMsgId, "user", nudgeContent, {
1828
- ...currentWindowMessageOptions ?? {},
1829
- isSystemGenerated: true,
1830
- messageKind: "correction",
1831
- metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
1832
- }));
1833
- eventStore.append(sessionId, { type: "message.done", data: { messageId: nudgeMsgId } });
1834
- if (onMessage) {
1835
- onMessage(createChatMessageMessage({
1836
- id: nudgeMsgId,
1837
- role: "user",
1838
- content: nudgeContent,
1839
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1840
- isSystemGenerated: true,
1841
- messageKind: "correction",
1842
- metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
1843
- }));
1844
- }
1837
+ emitWorkflowMessage(eventStore, sessionId, nudgeContent, currentWindowMessageOptions, onMessage);
1845
1838
  }
1846
1839
  const turnMetrics = new TurnMetrics();
1847
1840
  const agentResult = await runBuilderTurn({
@@ -2003,25 +1996,7 @@ ${output.slice(0, 1e4)}
2003
1996
  sessionManager.setPhase(sessionId, "blocked");
2004
1997
  const blockedCriteria = refreshedSession.criteria.filter((c) => c.status.type === "failed" && c.attempts.filter((a) => a.status === "failed").length >= RUNNER_CONFIG.maxVerifyRetries).map((c) => c.id);
2005
1998
  const reason = blockedCriteria.length > 0 ? `Retry limit reached for: ${blockedCriteria.join(", ")}` : "No matching transition";
2006
- const blockedMsgId = crypto.randomUUID();
2007
- eventStore.append(sessionId, createMessageStartEvent(blockedMsgId, "user", `Runner blocked: ${reason}`, {
2008
- ...currentWindowMessageOptions ?? {},
2009
- isSystemGenerated: true,
2010
- messageKind: "correction",
2011
- metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
2012
- }));
2013
- eventStore.append(sessionId, { type: "message.done", data: { messageId: blockedMsgId } });
2014
- if (onMessage) {
2015
- onMessage(createChatMessageMessage({
2016
- id: blockedMsgId,
2017
- role: "user",
2018
- content: `Runner blocked: ${reason}`,
2019
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2020
- isSystemGenerated: true,
2021
- messageKind: "correction",
2022
- metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
2023
- }));
2024
- }
1999
+ emitWorkflowMessage(eventStore, sessionId, `Runner blocked: ${reason}`, currentWindowMessageOptions, onMessage);
2025
2000
  logger.warn("Workflow executor blocked", { sessionId, iterations, reason });
2026
2001
  const blockedAction = { type: "BLOCKED", reason, blockedCriteria };
2027
2002
  return {
@@ -3174,7 +3149,7 @@ ${content}` : workflowInfo;
3174
3149
  }
3175
3150
 
3176
3151
  // src/server/lsp/server.ts
3177
- import { spawn as spawn3 } from "child_process";
3152
+ import { spawn as spawn2 } from "child_process";
3178
3153
  import { extname } from "path";
3179
3154
  import { createMessageConnection, StreamMessageReader, StreamMessageWriter } from "vscode-jsonrpc/node.js";
3180
3155
  var LSP = {
@@ -3236,7 +3211,7 @@ var LspServer = class {
3236
3211
  }
3237
3212
  this.state = "starting";
3238
3213
  try {
3239
- this.process = spawn3(this.commandPath, this.config.serverArgs, {
3214
+ this.process = spawn2(this.commandPath, this.config.serverArgs, {
3240
3215
  cwd: this.workdir,
3241
3216
  stdio: ["pipe", "pipe", "pipe"],
3242
3217
  env: {
@@ -4924,131 +4899,44 @@ ${summary}`,
4924
4899
  };
4925
4900
 
4926
4901
  // src/server/commands/registry.ts
4927
- import { readdir as readdir2, readFile as readFile3, writeFile as writeFile3, copyFile as copyFile2, mkdir as mkdir3, access as access3, unlink as unlink2 } from "fs/promises";
4928
- import { join as join4, dirname as dirname4 } from "path";
4929
- import { constants as constants3 } from "fs";
4930
- import { fileURLToPath as fileURLToPath3 } from "url";
4931
- import matter from "gray-matter";
4932
- var __bundleDir2 = dirname4(fileURLToPath3(import.meta.url));
4933
- var DEFAULTS_DIR2 = join4(__bundleDir2, "defaults");
4934
- var DEFAULTS_DIR_ALT2 = join4(__bundleDir2, "command-defaults");
4902
+ import { readdir as readdir2 } from "fs/promises";
4903
+ import { join as join4 } from "path";
4904
+ var DEFAULTS_DIR2 = "defaults";
4905
+ var DEFAULTS_DIR_ALT2 = "command-defaults";
4935
4906
  var COMMAND_EXTENSION = ".command.md";
4936
4907
  function getCommandsDir(configDir) {
4937
4908
  return join4(configDir, "commands");
4938
4909
  }
4939
- async function dirExists(path) {
4940
- try {
4941
- await access3(path, constants3.R_OK);
4942
- return true;
4943
- } catch {
4944
- return false;
4945
- }
4946
- }
4947
4910
  async function ensureDefaultCommands(configDir) {
4911
+ const bundleDir = getBundleDir();
4948
4912
  const commandsDir = getCommandsDir(configDir);
4949
- if (!await dirExists(commandsDir)) {
4950
- await mkdir3(commandsDir, { recursive: true });
4951
- }
4952
- let defaultFiles;
4953
- let sourceDir;
4954
- try {
4955
- defaultFiles = (await readdir2(DEFAULTS_DIR2)).filter((f) => f.endsWith(COMMAND_EXTENSION));
4956
- sourceDir = DEFAULTS_DIR2;
4957
- } catch {
4958
- try {
4959
- defaultFiles = (await readdir2(DEFAULTS_DIR_ALT2)).filter((f) => f.endsWith(COMMAND_EXTENSION));
4960
- sourceDir = DEFAULTS_DIR_ALT2;
4961
- } catch {
4962
- logger.warn("No bundled command defaults found", { dir: DEFAULTS_DIR2 });
4963
- return;
4964
- }
4965
- }
4966
- for (const file of defaultFiles) {
4967
- const targetPath = join4(commandsDir, file);
4968
- if (!await dirExists(targetPath)) {
4969
- try {
4970
- await copyFile2(join4(sourceDir, file), targetPath);
4971
- logger.info("Installed default command", { file });
4972
- } catch (err) {
4973
- logger.error("Failed to copy default command", { file, error: err instanceof Error ? err.message : String(err) });
4974
- }
4913
+ await ensureDir(commandsDir);
4914
+ const ids = await getDefaultIds(bundleDir, DEFAULTS_DIR2, COMMAND_EXTENSION);
4915
+ for (const id of ids) {
4916
+ if (!await restoreDefault(commandsDir, bundleDir, DEFAULTS_DIR2, id, COMMAND_EXTENSION)) {
4917
+ await restoreDefault(commandsDir, bundleDir, DEFAULTS_DIR_ALT2, id, COMMAND_EXTENSION);
4975
4918
  }
4976
4919
  }
4977
4920
  }
4978
4921
  async function loadAllCommands(configDir) {
4979
- const commandsDir = getCommandsDir(configDir);
4980
- if (!await dirExists(commandsDir)) {
4981
- return [];
4982
- }
4983
- let files;
4984
- try {
4985
- files = (await readdir2(commandsDir)).filter((f) => f.endsWith(COMMAND_EXTENSION));
4986
- } catch {
4987
- return [];
4988
- }
4989
- const commands = [];
4990
- for (const file of files) {
4991
- try {
4992
- const raw = await readFile3(join4(commandsDir, file), "utf-8");
4993
- const { data, content } = matter(raw);
4994
- const metadata = data;
4995
- if (metadata.id && content.trim()) {
4996
- commands.push({ metadata, prompt: content.trim() });
4997
- } else {
4998
- logger.warn("Skipping invalid command file", { file });
4999
- }
5000
- } catch (err) {
5001
- logger.warn("Failed to parse command file", { file, error: err instanceof Error ? err.message : String(err) });
5002
- }
5003
- }
5004
- return commands;
4922
+ return loadItems(getCommandsDir(configDir), COMMAND_EXTENSION);
5005
4923
  }
5006
4924
  async function getDefaultCommandIds() {
5007
- for (const dir of [DEFAULTS_DIR2, DEFAULTS_DIR_ALT2]) {
5008
- try {
5009
- const files = (await readdir2(dir)).filter((f) => f.endsWith(COMMAND_EXTENSION));
5010
- return files.map((f) => f.replace(COMMAND_EXTENSION, ""));
5011
- } catch {
5012
- }
5013
- }
5014
- return [];
4925
+ const bundleDir = getBundleDir();
4926
+ const ids = await getDefaultIds(bundleDir, DEFAULTS_DIR2, COMMAND_EXTENSION);
4927
+ if (ids.length) return ids;
4928
+ return getDefaultIds(bundleDir, DEFAULTS_DIR_ALT2, COMMAND_EXTENSION);
5015
4929
  }
5016
4930
  async function restoreDefaultCommand(configDir, commandId) {
5017
- const filename = `${commandId}${COMMAND_EXTENSION}`;
5018
- for (const dir of [DEFAULTS_DIR2, DEFAULTS_DIR_ALT2]) {
5019
- const sourcePath = join4(dir, filename);
5020
- if (await dirExists(sourcePath)) {
5021
- const targetPath = join4(getCommandsDir(configDir), filename);
5022
- await copyFile2(sourcePath, targetPath);
5023
- return true;
5024
- }
5025
- }
5026
- return false;
4931
+ const bundleDir = getBundleDir();
4932
+ const commandsDir = getCommandsDir(configDir);
4933
+ return restoreDefault(commandsDir, bundleDir, DEFAULTS_DIR2, commandId, COMMAND_EXTENSION) || restoreDefault(commandsDir, bundleDir, DEFAULTS_DIR_ALT2, commandId, COMMAND_EXTENSION);
5027
4934
  }
5028
4935
  async function getModifiedDefaultCommandIds(configDir) {
5029
- const defaultIds = await getDefaultCommandIds();
5030
- const modified = [];
5031
- for (const id of defaultIds) {
5032
- const filename = `${id}${COMMAND_EXTENSION}`;
5033
- const userPath = join4(getCommandsDir(configDir), filename);
5034
- let bundledContent = null;
5035
- for (const dir of [DEFAULTS_DIR2, DEFAULTS_DIR_ALT2]) {
5036
- try {
5037
- bundledContent = await readFile3(join4(dir, filename), "utf-8");
5038
- break;
5039
- } catch {
5040
- }
5041
- }
5042
- if (!bundledContent) continue;
5043
- try {
5044
- const userContent = await readFile3(userPath, "utf-8");
5045
- if (userContent !== bundledContent) {
5046
- modified.push(id);
5047
- }
5048
- } catch {
5049
- }
5050
- }
5051
- return modified;
4936
+ const bundleDir = getBundleDir();
4937
+ const ids = await getDefaultCommandIds();
4938
+ const files = (await readdir2(join4(bundleDir, DEFAULTS_DIR2))).filter((f) => f.endsWith(COMMAND_EXTENSION));
4939
+ return files.map((f) => f.replace(COMMAND_EXTENSION, "")).filter((id) => ids.includes(id));
5052
4940
  }
5053
4941
  async function restoreAllDefaultCommands(configDir) {
5054
4942
  const ids = await getDefaultCommandIds();
@@ -5059,29 +4947,16 @@ async function restoreAllDefaultCommands(configDir) {
5059
4947
  return count;
5060
4948
  }
5061
4949
  function findCommandById(commandId, commands) {
5062
- return commands.find((c) => c.metadata.id === commandId);
4950
+ return findById(commandId, commands);
5063
4951
  }
5064
4952
  async function commandExists(configDir, commandId) {
5065
- const filePath = join4(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`);
5066
- return dirExists(filePath);
4953
+ return dirExists(join4(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`));
5067
4954
  }
5068
4955
  async function saveCommand(configDir, command) {
5069
- const commandsDir = getCommandsDir(configDir);
5070
- if (!await dirExists(commandsDir)) {
5071
- await mkdir3(commandsDir, { recursive: true });
5072
- }
5073
- const filePath = join4(commandsDir, `${command.metadata.id}${COMMAND_EXTENSION}`);
5074
- const content = matter.stringify(command.prompt, command.metadata);
5075
- await writeFile3(filePath, content, "utf-8");
4956
+ return saveItem(getCommandsDir(configDir), command.metadata.id, COMMAND_EXTENSION, command);
5076
4957
  }
5077
4958
  async function deleteCommand(configDir, commandId) {
5078
- const filePath = join4(getCommandsDir(configDir), `${commandId}${COMMAND_EXTENSION}`);
5079
- try {
5080
- await unlink2(filePath);
5081
- return true;
5082
- } catch {
5083
- return false;
5084
- }
4959
+ return deleteItem(getCommandsDir(configDir), commandId, COMMAND_EXTENSION);
5085
4960
  }
5086
4961
 
5087
4962
  // src/server/routes/skills.ts
@@ -5544,10 +5419,10 @@ function createTerminalRoutes() {
5544
5419
  }
5545
5420
 
5546
5421
  // src/constants.ts
5547
- var VERSION = "1.6.14";
5422
+ var VERSION = "1.6.15";
5548
5423
 
5549
5424
  // src/server/index.ts
5550
- var __dirname2 = dirname5(fileURLToPath4(import.meta.url));
5425
+ var __dirname2 = dirname4(fileURLToPath3(import.meta.url));
5551
5426
  async function createServerHandle(config) {
5552
5427
  setRuntimeConfig(config);
5553
5428
  setLogLevel(config.logging?.level ?? void 0, config.mode);
@@ -5709,7 +5584,7 @@ async function createServerHandle(config) {
5709
5584
  res.json({ success: true });
5710
5585
  });
5711
5586
  app.get("/api/sessions", async (req, res) => {
5712
- const { getRecentUserPromptsForSession } = await import("./events-VDAC7E7K.js");
5587
+ const { getRecentUserPromptsForSession } = await import("./events-2ETDOE5B.js");
5713
5588
  const projectId = req.query["projectId"];
5714
5589
  const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
5715
5590
  const offset = parseInt(req.query["offset"]) || 0;
@@ -5742,8 +5617,8 @@ async function createServerHandle(config) {
5742
5617
  res.status(201).json({ session });
5743
5618
  });
5744
5619
  app.get("/api/sessions/:id", async (req, res) => {
5745
- const { getEventStore: getEventStore2 } = await import("./events-VDAC7E7K.js");
5746
- const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NDFQCISZ.js");
5620
+ const { getEventStore: getEventStore2 } = await import("./events-2ETDOE5B.js");
5621
+ const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-M7FMUBOL.js");
5747
5622
  const session = sessionManager.getSession(req.params.id);
5748
5623
  if (!session) {
5749
5624
  return res.status(404).json({ error: "Session not found" });
@@ -5773,8 +5648,8 @@ async function createServerHandle(config) {
5773
5648
  res.json({ success: true });
5774
5649
  });
5775
5650
  app.post("/api/sessions/:id/provider", async (req, res) => {
5776
- const { getEventStore: getEventStore2 } = await import("./events-VDAC7E7K.js");
5777
- const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NDFQCISZ.js");
5651
+ const { getEventStore: getEventStore2 } = await import("./events-2ETDOE5B.js");
5652
+ const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-M7FMUBOL.js");
5778
5653
  const sessionId = req.params.id;
5779
5654
  const session = sessionManager.getSession(sessionId);
5780
5655
  if (!session) {
@@ -5785,7 +5660,7 @@ async function createServerHandle(config) {
5785
5660
  return res.status(400).json({ error: "providerId is required" });
5786
5661
  }
5787
5662
  sessionManager.setSessionProvider(sessionId, providerId, model ?? "auto");
5788
- const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-DEM6ASQM.js");
5663
+ const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-67AX6CNS.js");
5789
5664
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
5790
5665
  const updatedConfig = setDefaultModelSelection(globalConfig, providerId, model ?? "auto");
5791
5666
  await saveGlobalConfig(config.mode ?? "production", updatedConfig);
@@ -5811,8 +5686,8 @@ async function createServerHandle(config) {
5811
5686
  res.json({ success: true });
5812
5687
  });
5813
5688
  app.put("/api/sessions/:id/mode", async (req, res) => {
5814
- const { getEventStore: getEventStore2 } = await import("./events-VDAC7E7K.js");
5815
- const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-NDFQCISZ.js");
5689
+ const { getEventStore: getEventStore2 } = await import("./events-2ETDOE5B.js");
5690
+ const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-M7FMUBOL.js");
5816
5691
  const sessionId = req.params.id;
5817
5692
  const session = sessionManager.getSession(sessionId);
5818
5693
  if (!session) {
@@ -5850,13 +5725,13 @@ async function createServerHandle(config) {
5850
5725
  if (!callId || approved === void 0) {
5851
5726
  return res.status(400).json({ error: "callId and approved are required" });
5852
5727
  }
5853
- const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-PLVK22CF.js");
5728
+ const { providePathConfirmation: providePathConfirmation2 } = await import("./tools-VOWNOP6V.js");
5854
5729
  const result = providePathConfirmation2(callId, approved, alwaysAllow);
5855
5730
  if (!result.found) {
5856
5731
  return res.status(404).json({ error: "No pending path confirmation with that ID" });
5857
5732
  }
5858
- const { getEventStore: getEventStore2 } = await import("./events-VDAC7E7K.js");
5859
- const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-NDFQCISZ.js");
5733
+ const { getEventStore: getEventStore2 } = await import("./events-2ETDOE5B.js");
5734
+ const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-M7FMUBOL.js");
5860
5735
  const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-KUKFSV5U.js");
5861
5736
  const eventStore = getEventStore2();
5862
5737
  const events = eventStore.getEvents(sessionId);
@@ -5875,7 +5750,7 @@ async function createServerHandle(config) {
5875
5750
  if (!callId || !answer) {
5876
5751
  return res.status(400).json({ error: "callId and answer are required" });
5877
5752
  }
5878
- const { provideAnswer: provideAnswer2 } = await import("./tools-PLVK22CF.js");
5753
+ const { provideAnswer: provideAnswer2 } = await import("./tools-VOWNOP6V.js");
5879
5754
  const found = provideAnswer2(callId, answer);
5880
5755
  if (!found) {
5881
5756
  return res.status(404).json({ error: "No pending question with that ID" });
@@ -5911,14 +5786,14 @@ async function createServerHandle(config) {
5911
5786
  if (!session) {
5912
5787
  return res.status(404).json({ error: "Session not found" });
5913
5788
  }
5914
- const { stopSessionExecution } = await import("./chat-handler-US3QOOE4.js");
5915
- const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-PLVK22CF.js");
5789
+ const { stopSessionExecution } = await import("./chat-handler-F2A2IMQB.js");
5790
+ const { cancelQuestionsForSession: cancelQuestionsForSession2, cancelPathConfirmationsForSession: cancelPathConfirmationsForSession2 } = await import("./tools-VOWNOP6V.js");
5916
5791
  stopSessionExecution(sessionId, sessionManager);
5917
5792
  abortSession(sessionId);
5918
5793
  cancelQuestionsForSession2(sessionId, "Session stopped by user");
5919
5794
  cancelPathConfirmationsForSession2(sessionId, "Session stopped by user");
5920
5795
  sessionManager.clearMessageQueue(sessionId);
5921
- const eventStore = (await import("./events-VDAC7E7K.js")).getEventStore();
5796
+ const eventStore = (await import("./events-2ETDOE5B.js")).getEventStore();
5922
5797
  eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
5923
5798
  res.json({ success: true });
5924
5799
  });
@@ -5970,7 +5845,7 @@ async function createServerHandle(config) {
5970
5845
  let visionFallback;
5971
5846
  let globalWorkdir;
5972
5847
  try {
5973
- const { loadGlobalConfig, getVisionFallback } = await import("./config-DEM6ASQM.js");
5848
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-67AX6CNS.js");
5974
5849
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
5975
5850
  const fallback = getVisionFallback(globalConfig);
5976
5851
  if (fallback) {
@@ -6049,7 +5924,7 @@ async function createServerHandle(config) {
6049
5924
  return res.status(400).json({ error: "name, url, and backend are required" });
6050
5925
  }
6051
5926
  try {
6052
- const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-DEM6ASQM.js");
5927
+ const { loadGlobalConfig, saveGlobalConfig, addProvider, setDefaultModelSelection } = await import("./config-67AX6CNS.js");
6053
5928
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6054
5929
  const providerBackend = backend;
6055
5930
  const configWithProvider = addProvider(globalConfig, {
@@ -6082,7 +5957,7 @@ async function createServerHandle(config) {
6082
5957
  app.post("/api/init/config", async (req, res) => {
6083
5958
  const { workdir, visionFallback } = req.body;
6084
5959
  try {
6085
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-DEM6ASQM.js");
5960
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-67AX6CNS.js");
6086
5961
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6087
5962
  const updatedConfig = {
6088
5963
  ...globalConfig,
@@ -6110,7 +5985,7 @@ async function createServerHandle(config) {
6110
5985
  });
6111
5986
  app.delete("/api/providers/:id", async (req, res) => {
6112
5987
  const { id } = req.params;
6113
- const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-DEM6ASQM.js");
5988
+ const { loadGlobalConfig, saveGlobalConfig, removeProvider } = await import("./config-67AX6CNS.js");
6114
5989
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6115
5990
  const updatedConfig = removeProvider(globalConfig, id);
6116
5991
  await saveGlobalConfig(config.mode ?? "production", updatedConfig);
@@ -6130,7 +6005,7 @@ async function createServerHandle(config) {
6130
6005
  return res.status(400).json({ error: result.error });
6131
6006
  }
6132
6007
  const llmClient = getLLMClient();
6133
- const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-DEM6ASQM.js");
6008
+ const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-67AX6CNS.js");
6134
6009
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6135
6010
  const updatedConfig = setDefaultModelSelection(globalConfig, id, llmClient.getModel());
6136
6011
  await saveGlobalConfig(config.mode ?? "production", updatedConfig);
@@ -6151,7 +6026,7 @@ async function createServerHandle(config) {
6151
6026
  if (!result.success) {
6152
6027
  return res.status(400).json({ error: result.error });
6153
6028
  }
6154
- const { loadGlobalConfig, saveGlobalConfig } = await import("./config-DEM6ASQM.js");
6029
+ const { loadGlobalConfig, saveGlobalConfig } = await import("./config-67AX6CNS.js");
6155
6030
  const globalConfig = await loadGlobalConfig(config.mode ?? "production");
6156
6031
  const updatedProviders = providerManager.getProviders();
6157
6032
  const updatedConfig = {
@@ -6234,7 +6109,7 @@ async function createServerHandle(config) {
6234
6109
  name: entry.name,
6235
6110
  path: join5(resolvedPath, entry.name)
6236
6111
  })).sort((a, b) => a.name.localeCompare(b.name));
6237
- const parent = dirname5(resolvedPath);
6112
+ const parent = dirname4(resolvedPath);
6238
6113
  const hasParent = parent !== resolvedPath;
6239
6114
  res.json({
6240
6115
  current: resolvedPath,
@@ -6279,7 +6154,7 @@ async function createServerHandle(config) {
6279
6154
  }
6280
6155
  });
6281
6156
  app.get("/fox.svg", (_req, res) => {
6282
- readFile4(join5(webDir, "fox.svg")).then((content) => {
6157
+ readFile3(join5(webDir, "fox.svg")).then((content) => {
6283
6158
  res.set("Content-Type", "image/svg+xml");
6284
6159
  res.send(content);
6285
6160
  }).catch(() => {
@@ -6298,7 +6173,7 @@ async function createServerHandle(config) {
6298
6173
  if (req.path.startsWith("/api/")) {
6299
6174
  return;
6300
6175
  }
6301
- readFile4(join5(webDir, "index.html"), "utf-8").then((indexHtml) => viteServer.transformIndexHtml(req.originalUrl, indexHtml)).then((transformed) => res.send(transformed)).catch((err) => {
6176
+ readFile3(join5(webDir, "index.html"), "utf-8").then((indexHtml) => viteServer.transformIndexHtml(req.originalUrl, indexHtml)).then((transformed) => res.send(transformed)).catch((err) => {
6302
6177
  logger.error("Error serving index.html", { error: err });
6303
6178
  res.status(500).send("Server error");
6304
6179
  });
@@ -6321,7 +6196,7 @@ async function createServerHandle(config) {
6321
6196
  app.use("/registerSW.js", express.static(join5(distWebDir, "registerSW.js")));
6322
6197
  app.use("/sw.js", express.static(join5(distWebDir, "sw.js")));
6323
6198
  app.get("/fox.svg", (_req, res) => {
6324
- readFile4(join5(distWebDir, "fox.svg")).then((content) => {
6199
+ readFile3(join5(distWebDir, "fox.svg")).then((content) => {
6325
6200
  res.set("Content-Type", "image/svg+xml");
6326
6201
  res.send(content);
6327
6202
  }).catch(() => {
@@ -6337,7 +6212,7 @@ async function createServerHandle(config) {
6337
6212
  })
6338
6213
  );
6339
6214
  app.get("/", (_req, res) => {
6340
- readFile4(join5(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
6215
+ readFile3(join5(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
6341
6216
  res.status(404).send("Web UI not built. Run `npm run build:web`");
6342
6217
  });
6343
6218
  });
@@ -6345,7 +6220,7 @@ async function createServerHandle(config) {
6345
6220
  if (req.path.startsWith("/api/") || req.path.startsWith("/assets/") || req.path.startsWith("/sounds/") || req.path.startsWith("/manifest.webmanifest") || req.path.startsWith("/registerSW.js") || req.path.startsWith("/sw.js") || req.path === "/fox.svg") {
6346
6221
  return;
6347
6222
  }
6348
- readFile4(join5(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
6223
+ readFile3(join5(distWebDir, "index.html"), "utf-8").then((content) => res.send(content)).catch(() => {
6349
6224
  res.status(404).send("Web UI not built");
6350
6225
  });
6351
6226
  });
@@ -6360,7 +6235,7 @@ async function createServerHandle(config) {
6360
6235
  providerManager
6361
6236
  );
6362
6237
  const wss = wssExports.wss;
6363
- const { QueueProcessor } = await import("./processor-KBSF2HFD.js");
6238
+ const { QueueProcessor } = await import("./processor-H5BQ5HQM.js");
6364
6239
  const queueProcessor = new QueueProcessor({
6365
6240
  sessionManager,
6366
6241
  providerManager,
@@ -6433,4 +6308,4 @@ export {
6433
6308
  createServerHandle,
6434
6309
  createServer
6435
6310
  };
6436
- //# sourceMappingURL=chunk-3JU6H6A4.js.map
6311
+ //# sourceMappingURL=chunk-G4E72ST3.js.map