openfox 2.0.89 → 2.0.91

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 (85) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/CHANGELOG.md +25 -0
  3. package/dist/{chat-handler-NOTXEOLF.js → chat-handler-PC5BUJGA.js} +26 -22
  4. package/dist/chunk-3NGD6IVM.js +65 -0
  5. package/dist/{chunk-E5D7V7XC.js → chunk-4IBFA5IF.js} +8 -8
  6. package/dist/{chunk-VFMHWU3E.js → chunk-54Q4TGG6.js} +7 -3
  7. package/dist/{chunk-TAHZHEJ4.js → chunk-6J5IZ2NL.js} +10 -3
  8. package/dist/{chunk-EZWSS7LG.js → chunk-6OAJNCRY.js} +9 -1
  9. package/dist/{chunk-SYU5GNPN.js → chunk-7YBGCZSI.js} +2 -2
  10. package/dist/{chunk-AGYP7AUV.js → chunk-AXFPEGJI.js} +2 -2
  11. package/dist/{chunk-67AVIA5G.js → chunk-BJHPUMRX.js} +2 -2
  12. package/dist/{chunk-Q4OPCXV4.js → chunk-C56Z4OVW.js} +2 -2
  13. package/dist/{chunk-U7RLUZBP.js → chunk-CFK34T26.js} +1 -1
  14. package/dist/{chunk-47WNBFDO.js → chunk-CND2YWIJ.js} +2 -2
  15. package/dist/{chunk-J2IVK667.js → chunk-DH32AHTL.js} +2 -2
  16. package/dist/{chunk-7JC5YWST.js → chunk-DVVRKNFS.js} +62 -475
  17. package/dist/chunk-FSLCOA4R.js +144 -0
  18. package/dist/{chunk-NTYWC6PD.js → chunk-GH5PL3JW.js} +3 -3
  19. package/dist/chunk-GPODFKPQ.js +7 -0
  20. package/dist/{chunk-5OGOPB3I.js → chunk-JJY5O2WH.js} +236 -146
  21. package/dist/{chunk-J7R25K6N.js → chunk-JX6WL56A.js} +7 -7
  22. package/dist/{chunk-NGIOAASU.js → chunk-K2O7JTCX.js} +1 -243
  23. package/dist/{chunk-RNXMN5QY.js → chunk-LT4MPTGU.js} +4 -4
  24. package/dist/{chunk-7TFKWFY3.js → chunk-NGN3Q26A.js} +88 -72
  25. package/dist/chunk-NLJXZZTB.js +246 -0
  26. package/dist/{chunk-OVSB5SFF.js → chunk-NO65CC2R.js} +82 -32
  27. package/dist/{chunk-N54PQSCH.js → chunk-OQTLFO4R.js} +3 -2
  28. package/dist/{chunk-U2ECZUAX.js → chunk-Q7CN4JOO.js} +22 -75
  29. package/dist/{chunk-Q6AKRIM2.js → chunk-ST4NYXLH.js} +9 -2
  30. package/dist/chunk-SXHGRPCI.js +443 -0
  31. package/dist/{chunk-2GQ7X2NP.js → chunk-U7D72C4O.js} +4 -4
  32. package/dist/{chunk-4S76VMPH.js → chunk-VJEVCZZA.js} +6 -4
  33. package/dist/{chunk-VPFUXGMM.js → chunk-VKWVPQJ5.js} +3 -1
  34. package/dist/{chunk-3QHXJ3DJ.js → chunk-WPACSSBS.js} +3 -3
  35. package/dist/{chunk-ANYBIATF.js → chunk-WWC3R3YL.js} +2 -2
  36. package/dist/cli/dev.js +1 -1
  37. package/dist/cli/index.js +1 -1
  38. package/dist/{client-2KVPLIV4.js → client-RBXMHFX3.js} +5 -5
  39. package/dist/{compactor-W2CUKE22.js → compactor-HW6GBRAG.js} +11 -10
  40. package/dist/{config-JN6MW5SL.js → config-XIYAPMX3.js} +2 -2
  41. package/dist/dynamic-context-TDD3Q43F.js +27 -0
  42. package/dist/{events-OD7MN3FL.js → events-ICX5KVET.js} +7 -7
  43. package/dist/{folding-TDDQ5CXT.js → folding-L2L4OHX6.js} +5 -5
  44. package/dist/http-client-E3CV6E5D.js +11 -0
  45. package/dist/{inspect-proxy-CN2MUFQ5.js → inspect-proxy-NZ3VSMSC.js} +4 -4
  46. package/dist/{manager-6UIC3QKJ.js → manager-ZPQ6VSM5.js} +5 -5
  47. package/dist/orchestrator-56LSHPPK.js +55 -0
  48. package/dist/package.json +1 -1
  49. package/dist/{path-security-M2JDUBKK.js → path-security-XENIR7SX.js} +10 -10
  50. package/dist/{platform-55N6FRRU.js → platform-UKZ2QC34.js} +4 -4
  51. package/dist/{processor-FE4ZJ7GS.js → processor-H6NFFRI2.js} +25 -22
  52. package/dist/{project-creator-W5VW22DC.js → project-creator-2WMZYQME.js} +3 -3
  53. package/dist/{projects-HZ3WVTKG.js → projects-N6KVZGMS.js} +3 -3
  54. package/dist/{protocol-BUA2W2KM.js → protocol-3GNSIGP4.js} +3 -3
  55. package/dist/{protocol-DKJPL2Ci.d.ts → protocol-CaSHnORC.d.ts} +15 -4
  56. package/dist/provider/index.d.ts +4 -4
  57. package/dist/{provider-I2P3NYUI.js → provider-SYYZI2KX.js} +8 -8
  58. package/dist/{provider-manager-OLDOHCR2.js → provider-manager-P3ZSA5QS.js} +6 -6
  59. package/dist/registry-ERUV33AP.js +46 -0
  60. package/dist/{serve-UMPDBCVG.js → serve-KNVANLAK.js} +32 -28
  61. package/dist/server/index.d.ts +3 -3
  62. package/dist/server/index.js +31 -27
  63. package/dist/server-H3525HD6.js +45 -0
  64. package/dist/session-overrides-NPVYNHTM.js +20 -0
  65. package/dist/{sessions-Q6SYLG6U.js → sessions-7KCM5QH4.js} +7 -5
  66. package/dist/{settings-PFZWX6VY.js → settings-2OVKFWR5.js} +3 -3
  67. package/dist/shared/index.d.ts +3 -3
  68. package/dist/shared/index.js +1 -1
  69. package/dist/{tools-NLKP65HF.js → tools-DXBIHSMY.js} +23 -20
  70. package/dist/{types-C4NrLRR1.d.ts → types-CHCZiJvw.d.ts} +4 -0
  71. package/dist/{types-B97Fb4vm.d.ts → types-Cw7L4Bze.d.ts} +1 -1
  72. package/dist/{update-BHTE5TMY.js → update-4BGMFSEG.js} +2 -2
  73. package/dist/{update-server-V6GJ43WH.js → update-server-4I6LXE5K.js} +2 -2
  74. package/dist/web/assets/index-Chu9JX0M.js +316 -0
  75. package/dist/web/assets/index-mS37wyUs.css +32 -0
  76. package/dist/web/index.html +2 -2
  77. package/dist/web/sw.js +1 -1
  78. package/dist/{workspace-N4QHV6J2.js → workspace-YLTMP3OX.js} +4 -4
  79. package/package.json +1 -1
  80. package/dist/chunk-TH4JF6XP.js +0 -7
  81. package/dist/http-client-IPJGJXNJ.js +0 -11
  82. package/dist/orchestrator-NQDWCULY.js +0 -51
  83. package/dist/server-4PB7BNE6.js +0 -41
  84. package/dist/web/assets/index-BQfVUhSC.css +0 -32
  85. package/dist/web/assets/index-C5sTYb--.js +0 -306
@@ -1,3 +1,6 @@
1
+ import {
2
+ startInspectProxy
3
+ } from "./chunk-DH32AHTL.js";
1
4
  import {
2
5
  checkAborted,
3
6
  createProcess,
@@ -8,41 +11,53 @@ import {
8
11
  spawnShellProcess,
9
12
  startProcessCommand,
10
13
  stopProcess
11
- } from "./chunk-2GQ7X2NP.js";
14
+ } from "./chunk-U7D72C4O.js";
15
+ import {
16
+ getMaxPerSession,
17
+ getSessionProcessCount,
18
+ terminateProcessTree
19
+ } from "./chunk-I72ACQ6R.js";
12
20
  import {
13
21
  createMcpTools
14
22
  } from "./chunk-NWO6GRYE.js";
15
23
  import {
16
24
  applyMcpServerUpdate
17
- } from "./chunk-VPFUXGMM.js";
25
+ } from "./chunk-VKWVPQJ5.js";
18
26
  import {
19
27
  getGitBranch,
20
28
  isGitRepository,
21
29
  listWorkspaces
22
- } from "./chunk-67AVIA5G.js";
30
+ } from "./chunk-BJHPUMRX.js";
31
+ import {
32
+ findSkillById,
33
+ getAllInstructions,
34
+ getEnabledSkillMetadata,
35
+ isSkillEnabled,
36
+ loadAllSkills
37
+ } from "./chunk-SXHGRPCI.js";
38
+ import {
39
+ getSessionDisabledServers
40
+ } from "./chunk-3NGD6IVM.js";
23
41
  import {
24
42
  PathAccessDeniedError,
25
43
  extractAbsolutePathsFromCommand,
26
44
  extractSensitivePathsFromCommand,
27
45
  registerPathConfirmation,
28
46
  requestPathAccess
29
- } from "./chunk-3QHXJ3DJ.js";
47
+ } from "./chunk-WPACSSBS.js";
30
48
  import {
31
49
  createChatDoneMessage,
32
50
  createChatMessageMessage,
33
51
  createChatMessageUpdatedMessage,
34
52
  createChatPathConfirmationMessage,
35
53
  createQueueStateMessage
36
- } from "./chunk-47WNBFDO.js";
54
+ } from "./chunk-CND2YWIJ.js";
37
55
  import {
38
56
  AskUserInterrupt,
39
57
  askUserTool
40
58
  } from "./chunk-EU3WWTFH.js";
41
59
  import {
42
- COMPACTION_PROMPT,
43
60
  TurnMetrics,
44
- buildBasePrompt,
45
- computeEffectiveTools,
46
61
  consumeStreamGenerator,
47
62
  createChatDoneEvent,
48
63
  createMessageDoneEvent,
@@ -50,23 +65,17 @@ import {
50
65
  createToolCallEvent,
51
66
  createToolResultEvent,
52
67
  streamLLMPure
53
- } from "./chunk-NGIOAASU.js";
68
+ } from "./chunk-K2O7JTCX.js";
54
69
  import {
55
- startInspectProxy
56
- } from "./chunk-J2IVK667.js";
57
- import {
58
- getProject
59
- } from "./chunk-Q6AKRIM2.js";
60
- import {
61
- getMaxPerSession,
62
- getSessionProcessCount,
63
- terminateProcessTree
64
- } from "./chunk-I72ACQ6R.js";
70
+ COMPACTION_PROMPT,
71
+ buildBasePrompt,
72
+ computeEffectiveTools
73
+ } from "./chunk-NLJXZZTB.js";
65
74
  import {
66
75
  getCurrentContextWindowId,
67
76
  getCurrentWindowMessageOptions,
68
77
  getEventStore
69
- } from "./chunk-RNXMN5QY.js";
78
+ } from "./chunk-LT4MPTGU.js";
70
79
  import {
71
80
  buildContextMessagesFromEventHistory,
72
81
  foldContextState,
@@ -76,16 +85,13 @@ import {
76
85
  handleToolResult,
77
86
  reorderToolMessages,
78
87
  stripOrphanedToolCalls
79
- } from "./chunk-AGYP7AUV.js";
88
+ } from "./chunk-AXFPEGJI.js";
80
89
  import {
81
- deleteItemFromDir,
82
90
  findAgentById,
83
91
  getRuntimeConfig,
84
92
  getSubAgents,
85
- loadAllAgentsDefault,
86
- loadItemsFromDir,
87
- pathExists
88
- } from "./chunk-7TFKWFY3.js";
93
+ loadAllAgentsDefault
94
+ } from "./chunk-NGN3Q26A.js";
89
95
  import {
90
96
  modelSupportsVision
91
97
  } from "./chunk-V4IE7HJY.js";
@@ -102,17 +108,15 @@ import {
102
108
  } from "./chunk-RMXPVQP4.js";
103
109
  import {
104
110
  SETTINGS_KEYS,
105
- deleteSetting,
106
- getSetting,
107
- setSetting
108
- } from "./chunk-VFMHWU3E.js";
111
+ getSetting
112
+ } from "./chunk-54Q4TGG6.js";
109
113
  import {
110
114
  logger
111
115
  } from "./chunk-K44MW7JJ.js";
112
116
  import {
113
117
  loadGlobalConfig,
114
118
  saveGlobalConfig
115
- } from "./chunk-N54PQSCH.js";
119
+ } from "./chunk-OQTLFO4R.js";
116
120
  import {
117
121
  getGlobalConfigDir
118
122
  } from "./chunk-CQGTEGKL.js";
@@ -129,7 +133,7 @@ async function requestUserConfirmation(context, toolLabel, desc) {
129
133
  if (context.dangerLevel === "dangerous") return Promise.resolve(true);
130
134
  if (toolLabel === "workspace" || toolLabel === "command") {
131
135
  try {
132
- const { getSetting: getSetting2, SETTINGS_KEYS: SETTINGS_KEYS2 } = await import("./settings-PFZWX6VY.js");
136
+ const { getSetting: getSetting2, SETTINGS_KEYS: SETTINGS_KEYS2 } = await import("./settings-2OVKFWR5.js");
133
137
  if (getSetting2(SETTINGS_KEYS2.CONFIRM_ON_WORKSPACE_ACTIONS) !== "true") {
134
138
  return Promise.resolve(true);
135
139
  }
@@ -1477,414 +1481,8 @@ ${Object.entries(schema.fields).map(([f, t]) => ` ${f}: ${t}`).join("\n")}`
1477
1481
  );
1478
1482
 
1479
1483
  // src/server/sub-agents/manager.ts
1480
- import { readFile as readFile6, access as access3 } from "fs/promises";
1481
- import { join as join4, dirname as dirname4, isAbsolute as isAbsolute2 } from "path";
1482
-
1483
- // src/server/context/instructions.ts
1484
1484
  import { readFile as readFile4, access as access2 } from "fs/promises";
1485
- import { join as join2, dirname as dirname2 } from "path";
1486
- import { constants } from "fs";
1487
- var INSTRUCTION_FILENAMES = ["AGENTS.md", "CLAUDE.md"];
1488
- async function findInstructionFiles(workdir) {
1489
- const foundFiles = [];
1490
- const pathsToCheck = [];
1491
- let currentDir = workdir;
1492
- while (true) {
1493
- pathsToCheck.unshift(currentDir);
1494
- const parentDir = dirname2(currentDir);
1495
- if (parentDir === currentDir) {
1496
- break;
1497
- }
1498
- currentDir = parentDir;
1499
- }
1500
- for (const dir of pathsToCheck) {
1501
- for (const filename of INSTRUCTION_FILENAMES) {
1502
- const filePath = join2(dir, filename);
1503
- if (await fileExists(filePath)) {
1504
- foundFiles.push({
1505
- path: filePath,
1506
- source: "agents-md"
1507
- });
1508
- }
1509
- }
1510
- }
1511
- return foundFiles;
1512
- }
1513
- async function loadInstructions(files) {
1514
- const contents = [];
1515
- for (const file of files) {
1516
- try {
1517
- const content = await readFile4(file.path, "utf-8");
1518
- contents.push(`Instructions from: ${file.path}
1519
- ${content}`);
1520
- } catch {
1521
- continue;
1522
- }
1523
- }
1524
- return contents.join("\n");
1525
- }
1526
- async function getAllInstructions(workdir, projectId) {
1527
- const sections = [];
1528
- const allFiles = [];
1529
- const globalInstructions = getSetting(SETTINGS_KEYS.GLOBAL_INSTRUCTIONS);
1530
- if (globalInstructions) {
1531
- sections.push(`## GLOBAL INSTRUCTIONS
1532
-
1533
- ${globalInstructions}`);
1534
- allFiles.push({ path: "Global Instructions", source: "global", content: globalInstructions });
1535
- }
1536
- const project = getProject(projectId);
1537
- if (project?.customInstructions) {
1538
- sections.push(`## PROJECT INSTRUCTIONS
1539
-
1540
- ${project.customInstructions}`);
1541
- allFiles.push({ path: `Project: ${project.name}`, source: "project", content: project.customInstructions });
1542
- }
1543
- const agentFiles = await findInstructionFiles(workdir);
1544
- if (agentFiles.length > 0) {
1545
- const agentContent = await loadInstructions(agentFiles);
1546
- if (agentContent) {
1547
- sections.push(`## FILE INSTRUCTIONS
1548
-
1549
- ${agentContent}`);
1550
- for (const file of agentFiles) {
1551
- try {
1552
- const content = await readFile4(file.path, "utf-8");
1553
- allFiles.push({ ...file, content });
1554
- } catch {
1555
- allFiles.push(file);
1556
- }
1557
- }
1558
- }
1559
- }
1560
- return {
1561
- content: sections.join("\n\n"),
1562
- files: allFiles
1563
- };
1564
- }
1565
- async function fileExists(path) {
1566
- try {
1567
- await access2(path, constants.R_OK);
1568
- return true;
1569
- } catch {
1570
- return false;
1571
- }
1572
- }
1573
-
1574
- // src/server/skills/registry.ts
1575
- import { writeFile as writeFile3, mkdir as mkdir2, unlink, readdir as readdir2, readFile as readFile5, realpath, rm } from "fs/promises";
1576
- import { join as join3, dirname as dirname3 } from "path";
1577
- import { fileURLToPath } from "url";
1578
- import { homedir } from "os";
1579
- import matter from "gray-matter";
1580
- var __bundleDir = dirname3(fileURLToPath(import.meta.url));
1581
- var DEFAULTS_DIR = join3(__bundleDir, "defaults");
1582
- var DEFAULTS_DIR_ALT = join3(__bundleDir, "skill-defaults");
1583
- var SKILL_EXTENSION = ".skill.md";
1584
- var SKILL_SETTING_PREFIX = "skill.enabled.";
1585
- var PORTABLE_NAME_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
1586
- function getSkillsDir(configDir) {
1587
- return join3(configDir, "skills");
1588
- }
1589
- function getProjectSkillsDir(projectDir) {
1590
- return join3(projectDir, ".openfox", "skills");
1591
- }
1592
- function portableDisplayName(data, id) {
1593
- const metadata = data["metadata"];
1594
- if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) return id;
1595
- const openfox = metadata["openfox"];
1596
- if (!openfox || typeof openfox !== "object" || Array.isArray(openfox)) return id;
1597
- const displayName = openfox["displayName"];
1598
- return typeof displayName === "string" && displayName.trim() ? displayName : id;
1599
- }
1600
- function portableVersion(data) {
1601
- const metadata = data["metadata"];
1602
- if (metadata && typeof metadata === "object" && !Array.isArray(metadata)) {
1603
- const version = metadata["version"];
1604
- if (version !== void 0) return String(version);
1605
- }
1606
- return data["version"] === void 0 ? "" : String(data["version"]);
1607
- }
1608
- async function loadPortableSkills(dir, source) {
1609
- let entries;
1610
- try {
1611
- entries = await readdir2(dir, { withFileTypes: true });
1612
- } catch {
1613
- return [];
1614
- }
1615
- const skills = [];
1616
- for (const entry of entries) {
1617
- if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
1618
- const packageDir = join3(dir, entry.name);
1619
- const entrypoint = join3(packageDir, "SKILL.md");
1620
- try {
1621
- const content = await readFile5(entrypoint, "utf-8");
1622
- const parsed = matter(content);
1623
- const data = parsed.data;
1624
- const id = typeof data["name"] === "string" ? data["name"].trim() : "";
1625
- const description = typeof data["description"] === "string" ? data["description"].trim() : "";
1626
- const prompt = parsed.content.trim();
1627
- if (!id || !description || !prompt) continue;
1628
- const resolvedDirectory = await realpath(packageDir);
1629
- const warnings = [];
1630
- if (id.length > 64 || !PORTABLE_NAME_REGEX.test(id)) {
1631
- warnings.push("Skill name must use 1-64 lowercase letters, numbers, and single hyphens");
1632
- }
1633
- if (id !== entry.name) {
1634
- warnings.push(`Skill name "${id}" does not match package directory "${entry.name}"`);
1635
- }
1636
- skills.push({
1637
- metadata: {
1638
- id,
1639
- name: portableDisplayName(data, id),
1640
- description,
1641
- version: portableVersion(data)
1642
- },
1643
- prompt,
1644
- rawMetadata: data,
1645
- entrypoint,
1646
- directory: resolvedDirectory,
1647
- source,
1648
- legacy: false,
1649
- warnings
1650
- });
1651
- } catch {
1652
- }
1653
- }
1654
- return skills;
1655
- }
1656
- async function annotateLegacySkills(skills, dir, source) {
1657
- return Promise.all(
1658
- skills.map(async (skill) => {
1659
- const entrypoint = join3(dir, `${skill.metadata.id}${SKILL_EXTENSION}`);
1660
- let resolvedEntrypoint = entrypoint;
1661
- try {
1662
- resolvedEntrypoint = await realpath(entrypoint);
1663
- } catch {
1664
- }
1665
- return {
1666
- ...skill,
1667
- rawMetadata: { ...skill.metadata },
1668
- entrypoint: resolvedEntrypoint,
1669
- directory: dirname3(resolvedEntrypoint),
1670
- source,
1671
- legacy: true,
1672
- warnings: ["Legacy .skill.md format"]
1673
- };
1674
- })
1675
- );
1676
- }
1677
- async function loadSkillsDirectory(dir, source) {
1678
- const [legacyRaw, portable] = await Promise.all([
1679
- loadItemsFromDir(dir, { extension: SKILL_EXTENSION, logName: "skill" }),
1680
- loadPortableSkills(dir, source)
1681
- ]);
1682
- const legacy = await annotateLegacySkills(legacyRaw, dir, source);
1683
- const merged = new Map(legacy.map((skill) => [skill.metadata.id, skill]));
1684
- for (const skill of portable) merged.set(skill.metadata.id, skill);
1685
- return [...merged.values()];
1686
- }
1687
- function getSelectedSkillDirectories() {
1688
- const raw = getSetting("skills.directories");
1689
- if (!raw) return [];
1690
- try {
1691
- const parsed = JSON.parse(raw);
1692
- return Array.isArray(parsed) ? parsed.filter((value) => typeof value === "string") : [];
1693
- } catch {
1694
- return [];
1695
- }
1696
- }
1697
- async function loadDefaultSkills() {
1698
- const defaults = await loadSkillsDirectory(DEFAULTS_DIR, "bundled");
1699
- if (defaults.length) return defaults;
1700
- return loadSkillsDirectory(DEFAULTS_DIR_ALT, "bundled");
1701
- }
1702
- async function loadUserSkills(configDir) {
1703
- return loadSkillsDirectory(getSkillsDir(configDir), "global-openfox");
1704
- }
1705
- async function loadProjectSkills(projectDir) {
1706
- return loadSkillsDirectory(getProjectSkillsDir(projectDir), "project-openfox");
1707
- }
1708
- async function loadAllSkills(configDir, projectDir, options = {}) {
1709
- return (await loadAllSkillsWithDiagnostics(configDir, projectDir, options)).skills;
1710
- }
1711
- async function loadAllSkillsWithDiagnostics(configDir, projectDir, options = {}) {
1712
- const home = options.homeDir ?? homedir();
1713
- const selected = (options.selectedDirectories ?? getSelectedSkillDirectories()).map(
1714
- (dir) => dir === "~" ? home : dir.startsWith("~/") ? join3(home, dir.slice(2)) : dir
1715
- );
1716
- const locations = [
1717
- loadDefaultSkills(),
1718
- loadSkillsDirectory(join3(home, ".agents", "skills"), "global-shared"),
1719
- loadUserSkills(configDir),
1720
- ...selected.map((dir) => loadSkillsDirectory(dir, "selected")),
1721
- ...projectDir ? [loadSkillsDirectory(join3(projectDir, ".agents", "skills"), "project-shared"), loadProjectSkills(projectDir)] : []
1722
- ];
1723
- const groups = await Promise.all(locations);
1724
- const skillMap = /* @__PURE__ */ new Map();
1725
- const diagnostics = [];
1726
- for (const group of groups) {
1727
- for (const skill of group) {
1728
- const previous = skillMap.get(skill.metadata.id);
1729
- if (previous) {
1730
- if (previous.directory === skill.directory && previous.legacy === skill.legacy) {
1731
- diagnostics.push(`Skill "${skill.metadata.id}" reached through multiple paths`);
1732
- } else {
1733
- diagnostics.push(
1734
- `Skill "${skill.metadata.id}" from ${skill.source ?? "unknown"} overrides ${previous.source ?? "unknown"}`
1735
- );
1736
- }
1737
- }
1738
- skillMap.set(skill.metadata.id, skill);
1739
- }
1740
- }
1741
- return { skills: Array.from(skillMap.values()), diagnostics };
1742
- }
1743
- async function getEnabledSkills(configDir, projectDir) {
1744
- const all = await loadAllSkills(configDir, projectDir);
1745
- return all.filter((s) => isSkillEnabled(s.metadata.id));
1746
- }
1747
- async function getEnabledSkillMetadata(configDir, projectDir) {
1748
- const enabled = await getEnabledSkills(configDir, projectDir);
1749
- return enabled.map((s) => s.metadata);
1750
- }
1751
- function isSkillEnabled(skillId) {
1752
- const value = getSetting(`${SKILL_SETTING_PREFIX}${skillId}`);
1753
- if (value === null) return true;
1754
- return value === "true";
1755
- }
1756
- function setSkillEnabled(skillId, enabled) {
1757
- setSetting(`${SKILL_SETTING_PREFIX}${skillId}`, String(enabled));
1758
- }
1759
- async function getDefaultSkillIds() {
1760
- const defaults = await loadDefaultSkills();
1761
- return defaults.map((s) => s.metadata.id);
1762
- }
1763
- async function isDefaultSkill(skillId) {
1764
- const defaultIds = await getDefaultSkillIds();
1765
- return defaultIds.includes(skillId);
1766
- }
1767
- function findSkillById(skillId, skills) {
1768
- return skills.find((s) => s.metadata.id === skillId);
1769
- }
1770
- async function skillExists(configDir, skillId, projectDir) {
1771
- if (await pathExists(join3(getSkillsDir(configDir), `${skillId}${SKILL_EXTENSION}`))) return true;
1772
- if (await pathExists(join3(getSkillsDir(configDir), skillId, "SKILL.md"))) return true;
1773
- if (projectDir && await pathExists(join3(getProjectSkillsDir(projectDir), `${skillId}${SKILL_EXTENSION}`)))
1774
- return true;
1775
- if (projectDir && await pathExists(join3(getProjectSkillsDir(projectDir), skillId, "SKILL.md"))) return true;
1776
- return false;
1777
- }
1778
- function portableFrontmatter(skill) {
1779
- const metadata = {};
1780
- if (skill.metadata.version) metadata["version"] = skill.metadata.version;
1781
- if (skill.metadata.name !== skill.metadata.id) {
1782
- metadata["openfox"] = { displayName: skill.metadata.name };
1783
- }
1784
- return {
1785
- name: skill.metadata.id,
1786
- description: skill.metadata.description,
1787
- ...Object.keys(metadata).length ? { metadata } : {}
1788
- };
1789
- }
1790
- async function savePortableSkill(dir, skill) {
1791
- const packageDir = join3(dir, skill.metadata.id);
1792
- await mkdir2(packageDir, { recursive: true });
1793
- await writeFile3(join3(packageDir, "SKILL.md"), matter.stringify(skill.prompt, portableFrontmatter(skill)), "utf-8");
1794
- }
1795
- async function saveSkill(configDir, skill) {
1796
- await savePortableSkill(getSkillsDir(configDir), skill);
1797
- }
1798
- async function saveSkillToProject(projectDir, skill) {
1799
- await savePortableSkill(getProjectSkillsDir(projectDir), skill);
1800
- }
1801
- function asRecord(value) {
1802
- return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
1803
- }
1804
- function updatedPortableFrontmatter(existing, metadata) {
1805
- const frontmatter = { ...existing.rawMetadata ?? {} };
1806
- const portableMetadata = { ...asRecord(frontmatter["metadata"]) };
1807
- const openfox = { ...asRecord(portableMetadata["openfox"]) };
1808
- frontmatter["name"] = existing.metadata.id;
1809
- frontmatter["description"] = metadata.description;
1810
- if (metadata.version) portableMetadata["version"] = metadata.version;
1811
- else delete portableMetadata["version"];
1812
- if (metadata.name !== existing.metadata.id) openfox["displayName"] = metadata.name;
1813
- else delete openfox["displayName"];
1814
- if (Object.keys(openfox).length) portableMetadata["openfox"] = openfox;
1815
- else delete portableMetadata["openfox"];
1816
- if (Object.keys(portableMetadata).length) frontmatter["metadata"] = portableMetadata;
1817
- else delete frontmatter["metadata"];
1818
- return frontmatter;
1819
- }
1820
- function canModifySkill(existing) {
1821
- if (existing.source === "global-openfox" || existing.source === "project-openfox") return true;
1822
- return !existing.legacy && (existing.source === "global-shared" || existing.source === "selected" || existing.source === "project-shared");
1823
- }
1824
- async function updateOwnedSkill(existing, changes) {
1825
- if (!existing.entrypoint || !canModifySkill(existing)) return null;
1826
- const normalizedMetadata = {
1827
- ...existing.metadata,
1828
- ...changes.metadata ?? {},
1829
- id: existing.metadata.id
1830
- };
1831
- if (!existing.legacy) {
1832
- const frontmatter = updatedPortableFrontmatter(existing, normalizedMetadata);
1833
- const updated2 = {
1834
- ...existing,
1835
- ...changes,
1836
- metadata: normalizedMetadata,
1837
- rawMetadata: frontmatter,
1838
- prompt: changes.prompt ?? existing.prompt
1839
- };
1840
- await writeFile3(existing.entrypoint, matter.stringify(updated2.prompt, frontmatter), "utf-8");
1841
- return updated2;
1842
- }
1843
- const metadata = {
1844
- ...existing.rawMetadata ?? existing.metadata,
1845
- ...changes.metadata ?? {},
1846
- id: existing.metadata.id
1847
- };
1848
- const updated = {
1849
- ...existing,
1850
- ...changes,
1851
- metadata,
1852
- rawMetadata: metadata,
1853
- prompt: changes.prompt ?? existing.prompt
1854
- };
1855
- await writeFile3(existing.entrypoint, matter.stringify(updated.prompt, metadata), "utf-8");
1856
- return updated;
1857
- }
1858
- async function deleteOwnedSkill(existing) {
1859
- if (!existing.entrypoint || !canModifySkill(existing)) {
1860
- return { success: false, reason: "This skill is read-only" };
1861
- }
1862
- try {
1863
- if (existing.legacy) await unlink(existing.entrypoint);
1864
- else await rm(dirname3(existing.entrypoint), { recursive: true });
1865
- deleteSetting(`${SKILL_SETTING_PREFIX}${existing.metadata.id}`);
1866
- return { success: true };
1867
- } catch {
1868
- return { success: false, reason: "Cannot delete this skill" };
1869
- }
1870
- }
1871
- async function deleteSkill(configDir, skillId) {
1872
- const isDefault = await isDefaultSkill(skillId);
1873
- if (isDefault) {
1874
- return { success: false, reason: "Cannot delete built-in defaults" };
1875
- }
1876
- const filePath = join3(getSkillsDir(configDir), `${skillId}${SKILL_EXTENSION}`);
1877
- try {
1878
- await unlink(filePath);
1879
- deleteSetting(`${SKILL_SETTING_PREFIX}${skillId}`);
1880
- return { success: true };
1881
- } catch {
1882
- return { success: false };
1883
- }
1884
- }
1885
- async function deleteProjectSkill(projectDir, skillId) {
1886
- return deleteItemFromDir(getProjectSkillsDir(projectDir), skillId, SKILL_EXTENSION);
1887
- }
1485
+ import { join as join2, dirname as dirname2, isAbsolute as isAbsolute2 } from "path";
1888
1486
 
1889
1487
  // src/server/chat/tool-streaming.ts
1890
1488
  function parseProgressMessage(message) {
@@ -2315,7 +1913,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
2315
1913
  sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens, config.subAgentMetadata?.subAgentId);
2316
1914
  if (!compacting) {
2317
1915
  const contextState2 = sessionManager.getContextState(sessionId);
2318
- const { shouldCompact, appendCompactionPrompt } = await import("./compactor-W2CUKE22.js");
1916
+ const { shouldCompact, appendCompactionPrompt } = await import("./compactor-HW6GBRAG.js");
2319
1917
  if (shouldCompact(
2320
1918
  contextState2.currentTokens,
2321
1919
  contextState2.maxTokens,
@@ -2678,7 +2276,7 @@ async function describeImageFromDataUrl(dataUrl, visionModel, options) {
2678
2276
  // src/server/context/image-processor.ts
2679
2277
  async function loadVisionModelFromGlobalConfig() {
2680
2278
  try {
2681
- const { loadGlobalConfig: loadGlobalConfig2, getVisionFallback } = await import("./config-JN6MW5SL.js");
2279
+ const { loadGlobalConfig: loadGlobalConfig2, getVisionFallback } = await import("./config-XIYAPMX3.js");
2682
2280
  const runtimeConfig = getRuntimeConfig();
2683
2281
  const mode = runtimeConfig.mode ?? "production";
2684
2282
  const globalConfig = await loadGlobalConfig2(mode);
@@ -3049,10 +2647,10 @@ async function loadGitIgnoreRules(workdir) {
3049
2647
  if (!isAbsolute2(workdir)) return "";
3050
2648
  let currentDir = workdir;
3051
2649
  while (true) {
3052
- const gitignorePath = join4(currentDir, ".gitignore");
2650
+ const gitignorePath = join2(currentDir, ".gitignore");
3053
2651
  try {
3054
- await access3(gitignorePath);
3055
- const content = await readFile6(gitignorePath, "utf-8");
2652
+ await access2(gitignorePath);
2653
+ const content = await readFile4(gitignorePath, "utf-8");
3056
2654
  const trimmed = content.trim();
3057
2655
  if (!trimmed) return "";
3058
2656
  const lines = trimmed.split("\n");
@@ -3066,7 +2664,7 @@ The following patterns from \`.gitignore\` should be excluded from file searches
3066
2664
  ${final}`;
3067
2665
  } catch {
3068
2666
  }
3069
- const parentDir = dirname4(currentDir);
2667
+ const parentDir = dirname2(currentDir);
3070
2668
  if (parentDir === currentDir) break;
3071
2669
  currentDir = parentDir;
3072
2670
  }
@@ -3254,7 +2852,7 @@ var callSubAgentTool = {
3254
2852
  };
3255
2853
  }
3256
2854
  try {
3257
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-NLKP65HF.js");
2855
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-DXBIHSMY.js");
3258
2856
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3259
2857
  const turnMetrics = new TurnMetrics();
3260
2858
  const result = await executeSubAgent({
@@ -3539,8 +3137,8 @@ var webFetchTool = createTool(
3539
3137
 
3540
3138
  // src/server/dev-server/manager.ts
3541
3139
  import "child_process";
3542
- import { readFile as readFile7, writeFile as writeFile4, mkdir as mkdir3 } from "fs/promises";
3543
- import { resolve as resolve4, join as join5 } from "path";
3140
+ import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir2 } from "fs/promises";
3141
+ import { resolve as resolve4, join as join3 } from "path";
3544
3142
  import net from "net";
3545
3143
  var MAX_LOG_LINES = 2e3;
3546
3144
  var MAX_LOG_BYTES = 1e5;
@@ -3548,7 +3146,7 @@ var DEFAULT_PROBE_PORT = 10469;
3548
3146
  var MAX_PORT_SCAN = 200;
3549
3147
  var PROBE_TIMEOUT_MS = 300;
3550
3148
  var getDevServerConfigPath = (workdir) => {
3551
- return join5(resolve4(workdir), ".openfox", "dev.json");
3149
+ return join3(resolve4(workdir), ".openfox", "dev.json");
3552
3150
  };
3553
3151
  var ERROR_PATTERNS = [
3554
3152
  /EADDRINUSE/,
@@ -3672,7 +3270,7 @@ var DevServerManager = class {
3672
3270
  const tryLoad = async (dir) => {
3673
3271
  try {
3674
3272
  const configPath = getDevServerConfigPath(dir);
3675
- const raw = await readFile7(configPath, "utf-8");
3273
+ const raw = await readFile5(configPath, "utf-8");
3676
3274
  const parsed = JSON.parse(raw);
3677
3275
  if (!parsed.command || !parsed.url) return null;
3678
3276
  return {
@@ -3698,10 +3296,10 @@ var DevServerManager = class {
3698
3296
  }
3699
3297
  async saveConfig(workdir, config) {
3700
3298
  const resolved = this.resolveWorkdir(workdir);
3701
- const dirPath = join5(resolved, ".openfox");
3702
- await mkdir3(dirPath, { recursive: true });
3299
+ const dirPath = join3(resolved, ".openfox");
3300
+ await mkdir2(dirPath, { recursive: true });
3703
3301
  const configPath = getDevServerConfigPath(workdir);
3704
- await writeFile4(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
3302
+ await writeFile3(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
3705
3303
  }
3706
3304
  async start(workdir) {
3707
3305
  const instance = this.getInstance(workdir);
@@ -4260,7 +3858,7 @@ var mcpConfigTool = createTool(
4260
3858
  mcpNotifyChanged?.(sessionId);
4261
3859
  }
4262
3860
  async function rebuildTools() {
4263
- const { setMcpTools: setMcpTools2 } = await import("./tools-NLKP65HF.js");
3861
+ const { setMcpTools: setMcpTools2 } = await import("./tools-DXBIHSMY.js");
4264
3862
  const mcpTools = createMcpTools(mcpManagerForTools);
4265
3863
  setMcpTools2(mcpTools);
4266
3864
  }
@@ -4857,16 +4455,24 @@ function getToolRegistryForSubAgent(toolNames) {
4857
4455
  const allowedToolsWithReturnValue = addReturnValueToAllowedTools(toolNames);
4858
4456
  return createRegistryFromTools(tools, allowedToolsWithReturnValue, toolPermissions, void 0, true);
4859
4457
  }
4860
- function getToolRegistryForAgent(agentDef) {
4458
+ function getToolRegistryForAgent(agentDef, sessionId) {
4861
4459
  if (agentDef.metadata.subagent) {
4862
4460
  return getToolRegistryForSubAgent(agentDef.metadata.allowedTools);
4863
4461
  }
4864
4462
  const allTools = getAllToolsMap();
4865
4463
  const tools = [];
4464
+ const disabledMcpServers = sessionId ? new Set(getSessionDisabledServers(sessionId)) : /* @__PURE__ */ new Set();
4866
4465
  for (const [name, tool] of allTools.entries()) {
4867
4466
  if (name === "return_value") {
4868
4467
  continue;
4869
4468
  }
4469
+ if (disabledMcpServers.size > 0) {
4470
+ const underscoreIdx = name.indexOf("_");
4471
+ if (underscoreIdx > 0) {
4472
+ const serverName = name.slice(0, underscoreIdx);
4473
+ if (disabledMcpServers.has(serverName)) continue;
4474
+ }
4475
+ }
4870
4476
  tools.push(tool);
4871
4477
  }
4872
4478
  const allowedTools = agentDef.metadata.allowedTools;
@@ -4878,25 +4484,6 @@ function createToolRegistry() {
4878
4484
  }
4879
4485
 
4880
4486
  export {
4881
- getAllInstructions,
4882
- loadDefaultSkills,
4883
- loadUserSkills,
4884
- loadProjectSkills,
4885
- loadAllSkills,
4886
- loadAllSkillsWithDiagnostics,
4887
- getEnabledSkillMetadata,
4888
- isSkillEnabled,
4889
- setSkillEnabled,
4890
- getDefaultSkillIds,
4891
- isDefaultSkill,
4892
- findSkillById,
4893
- skillExists,
4894
- saveSkill,
4895
- saveSkillToProject,
4896
- updateOwnedSkill,
4897
- deleteOwnedSkill,
4898
- deleteSkill,
4899
- deleteProjectSkill,
4900
4487
  runTopLevelAgentLoop,
4901
4488
  createAssemblyResult,
4902
4489
  getConversationMessages,
@@ -4917,4 +4504,4 @@ export {
4917
4504
  getToolRegistryForAgent,
4918
4505
  createToolRegistry
4919
4506
  };
4920
- //# sourceMappingURL=chunk-7JC5YWST.js.map
4507
+ //# sourceMappingURL=chunk-DVVRKNFS.js.map