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.
- package/CHANGELOG.md +25 -0
- package/dist/CHANGELOG.md +25 -0
- package/dist/{chat-handler-NOTXEOLF.js → chat-handler-PC5BUJGA.js} +26 -22
- package/dist/chunk-3NGD6IVM.js +65 -0
- package/dist/{chunk-E5D7V7XC.js → chunk-4IBFA5IF.js} +8 -8
- package/dist/{chunk-VFMHWU3E.js → chunk-54Q4TGG6.js} +7 -3
- package/dist/{chunk-TAHZHEJ4.js → chunk-6J5IZ2NL.js} +10 -3
- package/dist/{chunk-EZWSS7LG.js → chunk-6OAJNCRY.js} +9 -1
- package/dist/{chunk-SYU5GNPN.js → chunk-7YBGCZSI.js} +2 -2
- package/dist/{chunk-AGYP7AUV.js → chunk-AXFPEGJI.js} +2 -2
- package/dist/{chunk-67AVIA5G.js → chunk-BJHPUMRX.js} +2 -2
- package/dist/{chunk-Q4OPCXV4.js → chunk-C56Z4OVW.js} +2 -2
- package/dist/{chunk-U7RLUZBP.js → chunk-CFK34T26.js} +1 -1
- package/dist/{chunk-47WNBFDO.js → chunk-CND2YWIJ.js} +2 -2
- package/dist/{chunk-J2IVK667.js → chunk-DH32AHTL.js} +2 -2
- package/dist/{chunk-7JC5YWST.js → chunk-DVVRKNFS.js} +62 -475
- package/dist/chunk-FSLCOA4R.js +144 -0
- package/dist/{chunk-NTYWC6PD.js → chunk-GH5PL3JW.js} +3 -3
- package/dist/chunk-GPODFKPQ.js +7 -0
- package/dist/{chunk-5OGOPB3I.js → chunk-JJY5O2WH.js} +236 -146
- package/dist/{chunk-J7R25K6N.js → chunk-JX6WL56A.js} +7 -7
- package/dist/{chunk-NGIOAASU.js → chunk-K2O7JTCX.js} +1 -243
- package/dist/{chunk-RNXMN5QY.js → chunk-LT4MPTGU.js} +4 -4
- package/dist/{chunk-7TFKWFY3.js → chunk-NGN3Q26A.js} +88 -72
- package/dist/chunk-NLJXZZTB.js +246 -0
- package/dist/{chunk-OVSB5SFF.js → chunk-NO65CC2R.js} +82 -32
- package/dist/{chunk-N54PQSCH.js → chunk-OQTLFO4R.js} +3 -2
- package/dist/{chunk-U2ECZUAX.js → chunk-Q7CN4JOO.js} +22 -75
- package/dist/{chunk-Q6AKRIM2.js → chunk-ST4NYXLH.js} +9 -2
- package/dist/chunk-SXHGRPCI.js +443 -0
- package/dist/{chunk-2GQ7X2NP.js → chunk-U7D72C4O.js} +4 -4
- package/dist/{chunk-4S76VMPH.js → chunk-VJEVCZZA.js} +6 -4
- package/dist/{chunk-VPFUXGMM.js → chunk-VKWVPQJ5.js} +3 -1
- package/dist/{chunk-3QHXJ3DJ.js → chunk-WPACSSBS.js} +3 -3
- package/dist/{chunk-ANYBIATF.js → chunk-WWC3R3YL.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-2KVPLIV4.js → client-RBXMHFX3.js} +5 -5
- package/dist/{compactor-W2CUKE22.js → compactor-HW6GBRAG.js} +11 -10
- package/dist/{config-JN6MW5SL.js → config-XIYAPMX3.js} +2 -2
- package/dist/dynamic-context-TDD3Q43F.js +27 -0
- package/dist/{events-OD7MN3FL.js → events-ICX5KVET.js} +7 -7
- package/dist/{folding-TDDQ5CXT.js → folding-L2L4OHX6.js} +5 -5
- package/dist/http-client-E3CV6E5D.js +11 -0
- package/dist/{inspect-proxy-CN2MUFQ5.js → inspect-proxy-NZ3VSMSC.js} +4 -4
- package/dist/{manager-6UIC3QKJ.js → manager-ZPQ6VSM5.js} +5 -5
- package/dist/orchestrator-56LSHPPK.js +55 -0
- package/dist/package.json +1 -1
- package/dist/{path-security-M2JDUBKK.js → path-security-XENIR7SX.js} +10 -10
- package/dist/{platform-55N6FRRU.js → platform-UKZ2QC34.js} +4 -4
- package/dist/{processor-FE4ZJ7GS.js → processor-H6NFFRI2.js} +25 -22
- package/dist/{project-creator-W5VW22DC.js → project-creator-2WMZYQME.js} +3 -3
- package/dist/{projects-HZ3WVTKG.js → projects-N6KVZGMS.js} +3 -3
- package/dist/{protocol-BUA2W2KM.js → protocol-3GNSIGP4.js} +3 -3
- package/dist/{protocol-DKJPL2Ci.d.ts → protocol-CaSHnORC.d.ts} +15 -4
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-I2P3NYUI.js → provider-SYYZI2KX.js} +8 -8
- package/dist/{provider-manager-OLDOHCR2.js → provider-manager-P3ZSA5QS.js} +6 -6
- package/dist/registry-ERUV33AP.js +46 -0
- package/dist/{serve-UMPDBCVG.js → serve-KNVANLAK.js} +32 -28
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +31 -27
- package/dist/server-H3525HD6.js +45 -0
- package/dist/session-overrides-NPVYNHTM.js +20 -0
- package/dist/{sessions-Q6SYLG6U.js → sessions-7KCM5QH4.js} +7 -5
- package/dist/{settings-PFZWX6VY.js → settings-2OVKFWR5.js} +3 -3
- package/dist/shared/index.d.ts +3 -3
- package/dist/shared/index.js +1 -1
- package/dist/{tools-NLKP65HF.js → tools-DXBIHSMY.js} +23 -20
- package/dist/{types-C4NrLRR1.d.ts → types-CHCZiJvw.d.ts} +4 -0
- package/dist/{types-B97Fb4vm.d.ts → types-Cw7L4Bze.d.ts} +1 -1
- package/dist/{update-BHTE5TMY.js → update-4BGMFSEG.js} +2 -2
- package/dist/{update-server-V6GJ43WH.js → update-server-4I6LXE5K.js} +2 -2
- package/dist/web/assets/index-Chu9JX0M.js +316 -0
- package/dist/web/assets/index-mS37wyUs.css +32 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/{workspace-N4QHV6J2.js → workspace-YLTMP3OX.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-TH4JF6XP.js +0 -7
- package/dist/http-client-IPJGJXNJ.js +0 -11
- package/dist/orchestrator-NQDWCULY.js +0 -51
- package/dist/server-4PB7BNE6.js +0 -41
- package/dist/web/assets/index-BQfVUhSC.css +0 -32
- package/dist/web/assets/index-C5sTYb--.js +0 -306
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getProject
|
|
3
|
+
} from "./chunk-ST4NYXLH.js";
|
|
4
|
+
import {
|
|
5
|
+
deleteItemFromDir,
|
|
6
|
+
loadItemsFromDir,
|
|
7
|
+
pathExists
|
|
8
|
+
} from "./chunk-NGN3Q26A.js";
|
|
9
|
+
import {
|
|
10
|
+
SETTINGS_KEYS,
|
|
11
|
+
deleteSetting,
|
|
12
|
+
getSetting,
|
|
13
|
+
setSetting
|
|
14
|
+
} from "./chunk-54Q4TGG6.js";
|
|
15
|
+
|
|
16
|
+
// src/server/context/instructions.ts
|
|
17
|
+
import { readFile, access } from "fs/promises";
|
|
18
|
+
import { join, dirname } from "path";
|
|
19
|
+
import { constants } from "fs";
|
|
20
|
+
var INSTRUCTION_FILENAMES = ["AGENTS.md", "CLAUDE.md"];
|
|
21
|
+
async function findInstructionFiles(workdir) {
|
|
22
|
+
const foundFiles = [];
|
|
23
|
+
const pathsToCheck = [];
|
|
24
|
+
let currentDir = workdir;
|
|
25
|
+
while (true) {
|
|
26
|
+
pathsToCheck.unshift(currentDir);
|
|
27
|
+
const parentDir = dirname(currentDir);
|
|
28
|
+
if (parentDir === currentDir) {
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
currentDir = parentDir;
|
|
32
|
+
}
|
|
33
|
+
for (const dir of pathsToCheck) {
|
|
34
|
+
for (const filename of INSTRUCTION_FILENAMES) {
|
|
35
|
+
const filePath = join(dir, filename);
|
|
36
|
+
if (await fileExists(filePath)) {
|
|
37
|
+
foundFiles.push({
|
|
38
|
+
path: filePath,
|
|
39
|
+
source: "agents-md"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return foundFiles;
|
|
45
|
+
}
|
|
46
|
+
async function loadInstructions(files) {
|
|
47
|
+
const contents = [];
|
|
48
|
+
for (const file of files) {
|
|
49
|
+
try {
|
|
50
|
+
const content = await readFile(file.path, "utf-8");
|
|
51
|
+
contents.push(`Instructions from: ${file.path}
|
|
52
|
+
${content}`);
|
|
53
|
+
} catch {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return contents.join("\n");
|
|
58
|
+
}
|
|
59
|
+
async function getAllInstructions(workdir, projectId) {
|
|
60
|
+
const sections = [];
|
|
61
|
+
const allFiles = [];
|
|
62
|
+
const globalInstructions = getSetting(SETTINGS_KEYS.GLOBAL_INSTRUCTIONS);
|
|
63
|
+
if (globalInstructions) {
|
|
64
|
+
sections.push(`## GLOBAL INSTRUCTIONS
|
|
65
|
+
|
|
66
|
+
${globalInstructions}`);
|
|
67
|
+
allFiles.push({ path: "Global Instructions", source: "global", content: globalInstructions });
|
|
68
|
+
}
|
|
69
|
+
const project = getProject(projectId);
|
|
70
|
+
if (project?.customInstructions) {
|
|
71
|
+
sections.push(`## PROJECT INSTRUCTIONS
|
|
72
|
+
|
|
73
|
+
${project.customInstructions}`);
|
|
74
|
+
allFiles.push({ path: `Project: ${project.name}`, source: "project", content: project.customInstructions });
|
|
75
|
+
}
|
|
76
|
+
const agentFiles = await findInstructionFiles(workdir);
|
|
77
|
+
if (agentFiles.length > 0) {
|
|
78
|
+
const agentContent = await loadInstructions(agentFiles);
|
|
79
|
+
if (agentContent) {
|
|
80
|
+
sections.push(`## FILE INSTRUCTIONS
|
|
81
|
+
|
|
82
|
+
${agentContent}`);
|
|
83
|
+
for (const file of agentFiles) {
|
|
84
|
+
try {
|
|
85
|
+
const content = await readFile(file.path, "utf-8");
|
|
86
|
+
allFiles.push({ ...file, content });
|
|
87
|
+
} catch {
|
|
88
|
+
allFiles.push(file);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
content: sections.join("\n\n"),
|
|
95
|
+
files: allFiles
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
async function fileExists(path) {
|
|
99
|
+
try {
|
|
100
|
+
await access(path, constants.R_OK);
|
|
101
|
+
return true;
|
|
102
|
+
} catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/server/skills/registry.ts
|
|
108
|
+
import { writeFile, mkdir, unlink, readdir, readFile as readFile2, realpath, rm } from "fs/promises";
|
|
109
|
+
import { join as join2, dirname as dirname2 } from "path";
|
|
110
|
+
import { fileURLToPath } from "url";
|
|
111
|
+
import { homedir } from "os";
|
|
112
|
+
import matter from "gray-matter";
|
|
113
|
+
var __bundleDir = dirname2(fileURLToPath(import.meta.url));
|
|
114
|
+
var DEFAULTS_DIR = join2(__bundleDir, "defaults");
|
|
115
|
+
var DEFAULTS_DIR_ALT = join2(__bundleDir, "skill-defaults");
|
|
116
|
+
var SKILL_EXTENSION = ".skill.md";
|
|
117
|
+
var SKILL_SETTING_PREFIX = "skill.enabled.";
|
|
118
|
+
var PORTABLE_NAME_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
119
|
+
function getSkillsDir(configDir) {
|
|
120
|
+
return join2(configDir, "skills");
|
|
121
|
+
}
|
|
122
|
+
function getProjectSkillsDir(projectDir) {
|
|
123
|
+
return join2(projectDir, ".openfox", "skills");
|
|
124
|
+
}
|
|
125
|
+
function portableDisplayName(data, id) {
|
|
126
|
+
const metadata = data["metadata"];
|
|
127
|
+
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) return id;
|
|
128
|
+
const openfox = metadata["openfox"];
|
|
129
|
+
if (!openfox || typeof openfox !== "object" || Array.isArray(openfox)) return id;
|
|
130
|
+
const displayName = openfox["displayName"];
|
|
131
|
+
return typeof displayName === "string" && displayName.trim() ? displayName : id;
|
|
132
|
+
}
|
|
133
|
+
function portableVersion(data) {
|
|
134
|
+
const metadata = data["metadata"];
|
|
135
|
+
if (metadata && typeof metadata === "object" && !Array.isArray(metadata)) {
|
|
136
|
+
const version = metadata["version"];
|
|
137
|
+
if (version !== void 0) return String(version);
|
|
138
|
+
}
|
|
139
|
+
return data["version"] === void 0 ? "" : String(data["version"]);
|
|
140
|
+
}
|
|
141
|
+
async function loadPortableSkills(dir, source) {
|
|
142
|
+
let entries;
|
|
143
|
+
try {
|
|
144
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
145
|
+
} catch {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
const skills = [];
|
|
149
|
+
for (const entry of entries) {
|
|
150
|
+
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
151
|
+
const packageDir = join2(dir, entry.name);
|
|
152
|
+
const entrypoint = join2(packageDir, "SKILL.md");
|
|
153
|
+
try {
|
|
154
|
+
const content = await readFile2(entrypoint, "utf-8");
|
|
155
|
+
const parsed = matter(content);
|
|
156
|
+
const data = parsed.data;
|
|
157
|
+
const id = typeof data["name"] === "string" ? data["name"].trim() : "";
|
|
158
|
+
const description = typeof data["description"] === "string" ? data["description"].trim() : "";
|
|
159
|
+
const prompt = parsed.content.trim();
|
|
160
|
+
if (!id || !description || !prompt) continue;
|
|
161
|
+
const resolvedDirectory = await realpath(packageDir);
|
|
162
|
+
const warnings = [];
|
|
163
|
+
if (id.length > 64 || !PORTABLE_NAME_REGEX.test(id)) {
|
|
164
|
+
warnings.push("Skill name must use 1-64 lowercase letters, numbers, and single hyphens");
|
|
165
|
+
}
|
|
166
|
+
if (id !== entry.name) {
|
|
167
|
+
warnings.push(`Skill name "${id}" does not match package directory "${entry.name}"`);
|
|
168
|
+
}
|
|
169
|
+
skills.push({
|
|
170
|
+
metadata: {
|
|
171
|
+
id,
|
|
172
|
+
name: portableDisplayName(data, id),
|
|
173
|
+
description,
|
|
174
|
+
version: portableVersion(data)
|
|
175
|
+
},
|
|
176
|
+
prompt,
|
|
177
|
+
rawMetadata: data,
|
|
178
|
+
entrypoint,
|
|
179
|
+
directory: resolvedDirectory,
|
|
180
|
+
source,
|
|
181
|
+
legacy: false,
|
|
182
|
+
warnings
|
|
183
|
+
});
|
|
184
|
+
} catch {
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return skills;
|
|
188
|
+
}
|
|
189
|
+
async function annotateLegacySkills(skills, dir, source) {
|
|
190
|
+
return Promise.all(
|
|
191
|
+
skills.map(async (skill) => {
|
|
192
|
+
const entrypoint = join2(dir, `${skill.metadata.id}${SKILL_EXTENSION}`);
|
|
193
|
+
let resolvedEntrypoint = entrypoint;
|
|
194
|
+
try {
|
|
195
|
+
resolvedEntrypoint = await realpath(entrypoint);
|
|
196
|
+
} catch {
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
...skill,
|
|
200
|
+
rawMetadata: { ...skill.metadata },
|
|
201
|
+
entrypoint: resolvedEntrypoint,
|
|
202
|
+
directory: dirname2(resolvedEntrypoint),
|
|
203
|
+
source,
|
|
204
|
+
legacy: true,
|
|
205
|
+
warnings: ["Legacy .skill.md format"]
|
|
206
|
+
};
|
|
207
|
+
})
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
async function loadSkillsDirectory(dir, source) {
|
|
211
|
+
const [legacyRaw, portable] = await Promise.all([
|
|
212
|
+
loadItemsFromDir(dir, { extension: SKILL_EXTENSION, logName: "skill" }),
|
|
213
|
+
loadPortableSkills(dir, source)
|
|
214
|
+
]);
|
|
215
|
+
const legacy = await annotateLegacySkills(legacyRaw, dir, source);
|
|
216
|
+
const merged = new Map(legacy.map((skill) => [skill.metadata.id, skill]));
|
|
217
|
+
for (const skill of portable) merged.set(skill.metadata.id, skill);
|
|
218
|
+
return [...merged.values()];
|
|
219
|
+
}
|
|
220
|
+
function getSelectedSkillDirectories() {
|
|
221
|
+
const raw = getSetting("skills.directories");
|
|
222
|
+
if (!raw) return [];
|
|
223
|
+
try {
|
|
224
|
+
const parsed = JSON.parse(raw);
|
|
225
|
+
return Array.isArray(parsed) ? parsed.filter((value) => typeof value === "string") : [];
|
|
226
|
+
} catch {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async function loadDefaultSkills() {
|
|
231
|
+
const defaults = await loadSkillsDirectory(DEFAULTS_DIR, "bundled");
|
|
232
|
+
if (defaults.length) return defaults;
|
|
233
|
+
return loadSkillsDirectory(DEFAULTS_DIR_ALT, "bundled");
|
|
234
|
+
}
|
|
235
|
+
async function loadUserSkills(configDir) {
|
|
236
|
+
return loadSkillsDirectory(getSkillsDir(configDir), "global-openfox");
|
|
237
|
+
}
|
|
238
|
+
async function loadProjectSkills(projectDir) {
|
|
239
|
+
return loadSkillsDirectory(getProjectSkillsDir(projectDir), "project-openfox");
|
|
240
|
+
}
|
|
241
|
+
async function loadAllSkills(configDir, projectDir, options = {}) {
|
|
242
|
+
return (await loadAllSkillsWithDiagnostics(configDir, projectDir, options)).skills;
|
|
243
|
+
}
|
|
244
|
+
async function loadAllSkillsWithDiagnostics(configDir, projectDir, options = {}) {
|
|
245
|
+
const home = options.homeDir ?? homedir();
|
|
246
|
+
const selected = (options.selectedDirectories ?? getSelectedSkillDirectories()).map(
|
|
247
|
+
(dir) => dir === "~" ? home : dir.startsWith("~/") ? join2(home, dir.slice(2)) : dir
|
|
248
|
+
);
|
|
249
|
+
const locations = [
|
|
250
|
+
loadDefaultSkills(),
|
|
251
|
+
loadSkillsDirectory(join2(home, ".agents", "skills"), "global-shared"),
|
|
252
|
+
loadUserSkills(configDir),
|
|
253
|
+
...selected.map((dir) => loadSkillsDirectory(dir, "selected")),
|
|
254
|
+
...projectDir ? [loadSkillsDirectory(join2(projectDir, ".agents", "skills"), "project-shared"), loadProjectSkills(projectDir)] : []
|
|
255
|
+
];
|
|
256
|
+
const groups = await Promise.all(locations);
|
|
257
|
+
const skillMap = /* @__PURE__ */ new Map();
|
|
258
|
+
const diagnostics = [];
|
|
259
|
+
for (const group of groups) {
|
|
260
|
+
for (const skill of group) {
|
|
261
|
+
const previous = skillMap.get(skill.metadata.id);
|
|
262
|
+
if (previous) {
|
|
263
|
+
if (previous.directory === skill.directory && previous.legacy === skill.legacy) {
|
|
264
|
+
diagnostics.push(`Skill "${skill.metadata.id}" reached through multiple paths`);
|
|
265
|
+
} else {
|
|
266
|
+
diagnostics.push(
|
|
267
|
+
`Skill "${skill.metadata.id}" from ${skill.source ?? "unknown"} overrides ${previous.source ?? "unknown"}`
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
skillMap.set(skill.metadata.id, skill);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return { skills: Array.from(skillMap.values()), diagnostics };
|
|
275
|
+
}
|
|
276
|
+
async function getEnabledSkills(configDir, projectDir) {
|
|
277
|
+
const all = await loadAllSkills(configDir, projectDir);
|
|
278
|
+
return all.filter((s) => isSkillEnabled(s.metadata.id));
|
|
279
|
+
}
|
|
280
|
+
async function getEnabledSkillMetadata(configDir, projectDir) {
|
|
281
|
+
const enabled = await getEnabledSkills(configDir, projectDir);
|
|
282
|
+
return enabled.map((s) => s.metadata);
|
|
283
|
+
}
|
|
284
|
+
function isSkillEnabled(skillId) {
|
|
285
|
+
const value = getSetting(`${SKILL_SETTING_PREFIX}${skillId}`);
|
|
286
|
+
if (value === null) return true;
|
|
287
|
+
return value === "true";
|
|
288
|
+
}
|
|
289
|
+
function setSkillEnabled(skillId, enabled) {
|
|
290
|
+
setSetting(`${SKILL_SETTING_PREFIX}${skillId}`, String(enabled));
|
|
291
|
+
}
|
|
292
|
+
async function getDefaultSkillIds() {
|
|
293
|
+
const defaults = await loadDefaultSkills();
|
|
294
|
+
return defaults.map((s) => s.metadata.id);
|
|
295
|
+
}
|
|
296
|
+
async function isDefaultSkill(skillId) {
|
|
297
|
+
const defaultIds = await getDefaultSkillIds();
|
|
298
|
+
return defaultIds.includes(skillId);
|
|
299
|
+
}
|
|
300
|
+
function findSkillById(skillId, skills) {
|
|
301
|
+
return skills.find((s) => s.metadata.id === skillId);
|
|
302
|
+
}
|
|
303
|
+
async function skillExists(configDir, skillId, projectDir) {
|
|
304
|
+
if (await pathExists(join2(getSkillsDir(configDir), `${skillId}${SKILL_EXTENSION}`))) return true;
|
|
305
|
+
if (await pathExists(join2(getSkillsDir(configDir), skillId, "SKILL.md"))) return true;
|
|
306
|
+
if (projectDir && await pathExists(join2(getProjectSkillsDir(projectDir), `${skillId}${SKILL_EXTENSION}`)))
|
|
307
|
+
return true;
|
|
308
|
+
if (projectDir && await pathExists(join2(getProjectSkillsDir(projectDir), skillId, "SKILL.md"))) return true;
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
function portableFrontmatter(skill) {
|
|
312
|
+
const metadata = {};
|
|
313
|
+
if (skill.metadata.version) metadata["version"] = skill.metadata.version;
|
|
314
|
+
if (skill.metadata.name !== skill.metadata.id) {
|
|
315
|
+
metadata["openfox"] = { displayName: skill.metadata.name };
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
name: skill.metadata.id,
|
|
319
|
+
description: skill.metadata.description,
|
|
320
|
+
...Object.keys(metadata).length ? { metadata } : {}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
async function savePortableSkill(dir, skill) {
|
|
324
|
+
const packageDir = join2(dir, skill.metadata.id);
|
|
325
|
+
await mkdir(packageDir, { recursive: true });
|
|
326
|
+
await writeFile(join2(packageDir, "SKILL.md"), matter.stringify(skill.prompt, portableFrontmatter(skill)), "utf-8");
|
|
327
|
+
}
|
|
328
|
+
async function saveSkill(configDir, skill) {
|
|
329
|
+
await savePortableSkill(getSkillsDir(configDir), skill);
|
|
330
|
+
}
|
|
331
|
+
async function saveSkillToProject(projectDir, skill) {
|
|
332
|
+
await savePortableSkill(getProjectSkillsDir(projectDir), skill);
|
|
333
|
+
}
|
|
334
|
+
function asRecord(value) {
|
|
335
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
336
|
+
}
|
|
337
|
+
function updatedPortableFrontmatter(existing, metadata) {
|
|
338
|
+
const frontmatter = { ...existing.rawMetadata ?? {} };
|
|
339
|
+
const portableMetadata = { ...asRecord(frontmatter["metadata"]) };
|
|
340
|
+
const openfox = { ...asRecord(portableMetadata["openfox"]) };
|
|
341
|
+
frontmatter["name"] = existing.metadata.id;
|
|
342
|
+
frontmatter["description"] = metadata.description;
|
|
343
|
+
if (metadata.version) portableMetadata["version"] = metadata.version;
|
|
344
|
+
else delete portableMetadata["version"];
|
|
345
|
+
if (metadata.name !== existing.metadata.id) openfox["displayName"] = metadata.name;
|
|
346
|
+
else delete openfox["displayName"];
|
|
347
|
+
if (Object.keys(openfox).length) portableMetadata["openfox"] = openfox;
|
|
348
|
+
else delete portableMetadata["openfox"];
|
|
349
|
+
if (Object.keys(portableMetadata).length) frontmatter["metadata"] = portableMetadata;
|
|
350
|
+
else delete frontmatter["metadata"];
|
|
351
|
+
return frontmatter;
|
|
352
|
+
}
|
|
353
|
+
function canModifySkill(existing) {
|
|
354
|
+
if (existing.source === "global-openfox" || existing.source === "project-openfox") return true;
|
|
355
|
+
return !existing.legacy && (existing.source === "global-shared" || existing.source === "selected" || existing.source === "project-shared");
|
|
356
|
+
}
|
|
357
|
+
async function updateOwnedSkill(existing, changes) {
|
|
358
|
+
if (!existing.entrypoint || !canModifySkill(existing)) return null;
|
|
359
|
+
const normalizedMetadata = {
|
|
360
|
+
...existing.metadata,
|
|
361
|
+
...changes.metadata ?? {},
|
|
362
|
+
id: existing.metadata.id
|
|
363
|
+
};
|
|
364
|
+
if (!existing.legacy) {
|
|
365
|
+
const frontmatter = updatedPortableFrontmatter(existing, normalizedMetadata);
|
|
366
|
+
const updated2 = {
|
|
367
|
+
...existing,
|
|
368
|
+
...changes,
|
|
369
|
+
metadata: normalizedMetadata,
|
|
370
|
+
rawMetadata: frontmatter,
|
|
371
|
+
prompt: changes.prompt ?? existing.prompt
|
|
372
|
+
};
|
|
373
|
+
await writeFile(existing.entrypoint, matter.stringify(updated2.prompt, frontmatter), "utf-8");
|
|
374
|
+
return updated2;
|
|
375
|
+
}
|
|
376
|
+
const metadata = {
|
|
377
|
+
...existing.rawMetadata ?? existing.metadata,
|
|
378
|
+
...changes.metadata ?? {},
|
|
379
|
+
id: existing.metadata.id
|
|
380
|
+
};
|
|
381
|
+
const updated = {
|
|
382
|
+
...existing,
|
|
383
|
+
...changes,
|
|
384
|
+
metadata,
|
|
385
|
+
rawMetadata: metadata,
|
|
386
|
+
prompt: changes.prompt ?? existing.prompt
|
|
387
|
+
};
|
|
388
|
+
await writeFile(existing.entrypoint, matter.stringify(updated.prompt, metadata), "utf-8");
|
|
389
|
+
return updated;
|
|
390
|
+
}
|
|
391
|
+
async function deleteOwnedSkill(existing) {
|
|
392
|
+
if (!existing.entrypoint || !canModifySkill(existing)) {
|
|
393
|
+
return { success: false, reason: "This skill is read-only" };
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
if (existing.legacy) await unlink(existing.entrypoint);
|
|
397
|
+
else await rm(dirname2(existing.entrypoint), { recursive: true });
|
|
398
|
+
deleteSetting(`${SKILL_SETTING_PREFIX}${existing.metadata.id}`);
|
|
399
|
+
return { success: true };
|
|
400
|
+
} catch {
|
|
401
|
+
return { success: false, reason: "Cannot delete this skill" };
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
async function deleteSkill(configDir, skillId) {
|
|
405
|
+
const isDefault = await isDefaultSkill(skillId);
|
|
406
|
+
if (isDefault) {
|
|
407
|
+
return { success: false, reason: "Cannot delete built-in defaults" };
|
|
408
|
+
}
|
|
409
|
+
const filePath = join2(getSkillsDir(configDir), `${skillId}${SKILL_EXTENSION}`);
|
|
410
|
+
try {
|
|
411
|
+
await unlink(filePath);
|
|
412
|
+
deleteSetting(`${SKILL_SETTING_PREFIX}${skillId}`);
|
|
413
|
+
return { success: true };
|
|
414
|
+
} catch {
|
|
415
|
+
return { success: false };
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
async function deleteProjectSkill(projectDir, skillId) {
|
|
419
|
+
return deleteItemFromDir(getProjectSkillsDir(projectDir), skillId, SKILL_EXTENSION);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export {
|
|
423
|
+
getAllInstructions,
|
|
424
|
+
loadDefaultSkills,
|
|
425
|
+
loadUserSkills,
|
|
426
|
+
loadProjectSkills,
|
|
427
|
+
loadAllSkills,
|
|
428
|
+
loadAllSkillsWithDiagnostics,
|
|
429
|
+
getEnabledSkillMetadata,
|
|
430
|
+
isSkillEnabled,
|
|
431
|
+
setSkillEnabled,
|
|
432
|
+
getDefaultSkillIds,
|
|
433
|
+
isDefaultSkill,
|
|
434
|
+
findSkillById,
|
|
435
|
+
skillExists,
|
|
436
|
+
saveSkill,
|
|
437
|
+
saveSkillToProject,
|
|
438
|
+
updateOwnedSkill,
|
|
439
|
+
deleteOwnedSkill,
|
|
440
|
+
deleteSkill,
|
|
441
|
+
deleteProjectSkill
|
|
442
|
+
};
|
|
443
|
+
//# sourceMappingURL=chunk-SXHGRPCI.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getPlatformShell
|
|
3
|
-
} from "./chunk-ANYBIATF.js";
|
|
4
1
|
import {
|
|
5
2
|
appendLog,
|
|
6
3
|
createProcess,
|
|
@@ -12,6 +9,9 @@ import {
|
|
|
12
9
|
startProcess,
|
|
13
10
|
updateStatus
|
|
14
11
|
} from "./chunk-I72ACQ6R.js";
|
|
12
|
+
import {
|
|
13
|
+
getPlatformShell
|
|
14
|
+
} from "./chunk-WWC3R3YL.js";
|
|
15
15
|
|
|
16
16
|
// src/server/utils/shell.ts
|
|
17
17
|
import { spawn } from "child_process";
|
|
@@ -153,4 +153,4 @@ export {
|
|
|
153
153
|
getSessionProcesses2 as getSessionProcesses,
|
|
154
154
|
getProcessLogs
|
|
155
155
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-U7D72C4O.js.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
COMPACTION_PROMPT,
|
|
3
2
|
createMessageStartEvent
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-K2O7JTCX.js";
|
|
4
|
+
import {
|
|
5
|
+
COMPACTION_PROMPT
|
|
6
|
+
} from "./chunk-NLJXZZTB.js";
|
|
5
7
|
import {
|
|
6
8
|
getCurrentWindowMessageOptions
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LT4MPTGU.js";
|
|
8
10
|
|
|
9
11
|
// src/server/context/compactor.ts
|
|
10
12
|
function appendCompactionPrompt(sessionId, append) {
|
|
@@ -34,4 +36,4 @@ export {
|
|
|
34
36
|
COMPACTION_MAX_RATIO,
|
|
35
37
|
shouldCompact
|
|
36
38
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-VJEVCZZA.js.map
|
|
@@ -9,6 +9,7 @@ function buildUpdatedServerConfig(patch, existing, persistedCfg) {
|
|
|
9
9
|
const mergedUrl = patch.url !== void 0 ? patch.url : transportChanged ? void 0 : existing.config.url;
|
|
10
10
|
const mergedHeaders = patch.headers !== void 0 ? patch.headers : transportChanged ? void 0 : existing.config.headers;
|
|
11
11
|
const mergedTimeout = patch.timeout !== void 0 ? patch.timeout : existing.config.timeout;
|
|
12
|
+
const mergedDisabled = patch.disabled !== void 0 ? patch.disabled : existing.config.disabled;
|
|
12
13
|
if (patch.timeout !== void 0 && (typeof patch.timeout !== "number" || patch.timeout <= 0)) {
|
|
13
14
|
return { serverCfg: {}, error: "timeout must be a positive number" };
|
|
14
15
|
}
|
|
@@ -26,6 +27,7 @@ function buildUpdatedServerConfig(patch, existing, persistedCfg) {
|
|
|
26
27
|
...mergedUrl ? { url: mergedUrl } : {},
|
|
27
28
|
...mergedHeaders && Object.keys(mergedHeaders).length > 0 ? { headers: mergedHeaders } : {},
|
|
28
29
|
...mergedTimeout !== void 0 ? { timeout: mergedTimeout } : {},
|
|
30
|
+
...mergedDisabled !== void 0 ? { disabled: mergedDisabled } : {},
|
|
29
31
|
...persistedCfg?.disabledTools && persistedCfg.disabledTools.length > 0 ? { disabledTools: persistedCfg.disabledTools } : {},
|
|
30
32
|
...persistedCfg?.cachedTools && persistedCfg.cachedTools.length > 0 ? { cachedTools: persistedCfg.cachedTools } : {}
|
|
31
33
|
};
|
|
@@ -56,4 +58,4 @@ export {
|
|
|
56
58
|
buildUpdatedServerConfig,
|
|
57
59
|
applyMcpServerUpdate
|
|
58
60
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-VKWVPQJ5.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createChatPathConfirmationMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CND2YWIJ.js";
|
|
4
4
|
import {
|
|
5
5
|
getEventStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LT4MPTGU.js";
|
|
7
7
|
|
|
8
8
|
// src/server/tools/path-security.ts
|
|
9
9
|
import { realpath } from "fs/promises";
|
|
@@ -494,4 +494,4 @@ export {
|
|
|
494
494
|
getConfirmationSessionId,
|
|
495
495
|
getPendingConfirmationsBySession
|
|
496
496
|
};
|
|
497
|
-
//# sourceMappingURL=chunk-
|
|
497
|
+
//# sourceMappingURL=chunk-WPACSSBS.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETTINGS_KEYS,
|
|
3
3
|
getSetting
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-54Q4TGG6.js";
|
|
5
5
|
|
|
6
6
|
// src/server/utils/platform.ts
|
|
7
7
|
import os from "os";
|
|
@@ -63,4 +63,4 @@ export {
|
|
|
63
63
|
isWindowsPath,
|
|
64
64
|
isAbsolutePath
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-WWC3R3YL.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLLMClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-C56Z4OVW.js";
|
|
4
4
|
import "./chunk-V4IE7HJY.js";
|
|
5
5
|
import "./chunk-YHEQTVFV.js";
|
|
6
6
|
import "./chunk-HNCM3D7Y.js";
|
|
7
7
|
import "./chunk-RMXPVQP4.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-7YBGCZSI.js";
|
|
9
|
+
import "./chunk-54Q4TGG6.js";
|
|
10
|
+
import "./chunk-6OAJNCRY.js";
|
|
11
11
|
import "./chunk-K44MW7JJ.js";
|
|
12
12
|
import "./chunk-5WRI5ZAA.js";
|
|
13
13
|
export {
|
|
14
14
|
createLLMClient
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=client-
|
|
16
|
+
//# sourceMappingURL=client-RBXMHFX3.js.map
|
|
@@ -3,19 +3,20 @@ import {
|
|
|
3
3
|
COMPACTION_MAX_RATIO,
|
|
4
4
|
appendCompactionPrompt,
|
|
5
5
|
shouldCompact
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-VJEVCZZA.js";
|
|
7
|
+
import "./chunk-K2O7JTCX.js";
|
|
8
|
+
import "./chunk-NLJXZZTB.js";
|
|
9
|
+
import "./chunk-LT4MPTGU.js";
|
|
10
|
+
import "./chunk-WWC3R3YL.js";
|
|
11
|
+
import "./chunk-AXFPEGJI.js";
|
|
12
|
+
import "./chunk-6J5IZ2NL.js";
|
|
13
|
+
import "./chunk-NGN3Q26A.js";
|
|
13
14
|
import "./chunk-J2GP3J3X.js";
|
|
14
15
|
import "./chunk-V4IE7HJY.js";
|
|
15
16
|
import "./chunk-YHEQTVFV.js";
|
|
16
17
|
import "./chunk-RMXPVQP4.js";
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-54Q4TGG6.js";
|
|
19
|
+
import "./chunk-6OAJNCRY.js";
|
|
19
20
|
import "./chunk-K44MW7JJ.js";
|
|
20
21
|
import "./chunk-CQGTEGKL.js";
|
|
21
22
|
import "./chunk-5WRI5ZAA.js";
|
|
@@ -25,4 +26,4 @@ export {
|
|
|
25
26
|
appendCompactionPrompt,
|
|
26
27
|
shouldCompact
|
|
27
28
|
};
|
|
28
|
-
//# sourceMappingURL=compactor-
|
|
29
|
+
//# sourceMappingURL=compactor-HW6GBRAG.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
saveGlobalConfig,
|
|
12
12
|
setDefaultModelSelection,
|
|
13
13
|
updateProvider
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OQTLFO4R.js";
|
|
15
15
|
import "./chunk-CQGTEGKL.js";
|
|
16
16
|
import "./chunk-5WRI5ZAA.js";
|
|
17
17
|
export {
|
|
@@ -28,4 +28,4 @@ export {
|
|
|
28
28
|
setDefaultModelSelection,
|
|
29
29
|
updateProvider
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=config-
|
|
31
|
+
//# sourceMappingURL=config-XIYAPMX3.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
applyDynamicContext,
|
|
3
|
+
buildCachedPrompt,
|
|
4
|
+
computeDynamicContextHash,
|
|
5
|
+
computeSessionHash,
|
|
6
|
+
computeUnifiedDiff,
|
|
7
|
+
getToolFingerprint
|
|
8
|
+
} from "./chunk-FSLCOA4R.js";
|
|
9
|
+
import "./chunk-SXHGRPCI.js";
|
|
10
|
+
import "./chunk-ST4NYXLH.js";
|
|
11
|
+
import "./chunk-NLJXZZTB.js";
|
|
12
|
+
import "./chunk-WWC3R3YL.js";
|
|
13
|
+
import "./chunk-NGN3Q26A.js";
|
|
14
|
+
import "./chunk-54Q4TGG6.js";
|
|
15
|
+
import "./chunk-6OAJNCRY.js";
|
|
16
|
+
import "./chunk-K44MW7JJ.js";
|
|
17
|
+
import "./chunk-CQGTEGKL.js";
|
|
18
|
+
import "./chunk-5WRI5ZAA.js";
|
|
19
|
+
export {
|
|
20
|
+
applyDynamicContext,
|
|
21
|
+
buildCachedPrompt,
|
|
22
|
+
computeDynamicContextHash,
|
|
23
|
+
computeSessionHash,
|
|
24
|
+
computeUnifiedDiff,
|
|
25
|
+
getToolFingerprint
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=dynamic-context-TDD3Q43F.js.map
|