openfox 2.0.15 → 2.0.17
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/dist/{chat-handler-RYOG3WJP.js → chat-handler-DTMB43CD.js} +4 -4
- package/dist/{chunk-EKTGRBDC.js → chunk-5ANV7YUX.js} +5 -5
- package/dist/{chunk-2GX5EIIU.js → chunk-BC7R4HLY.js} +20 -20
- package/dist/{chunk-KPKSN362.js → chunk-KYR4NVNX.js} +206 -14
- package/dist/{chunk-Z64KW2HD.js → chunk-MS3PEYZK.js} +2 -2
- package/dist/{chunk-XAMAYRDA.js → chunk-O4TED6AJ.js} +5 -1
- package/dist/{chunk-3IKRNKPI.js → chunk-YGNOTMV7.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{orchestrator-KRCVDTZ6.js → orchestrator-FNAU26B6.js} +4 -4
- package/dist/package.json +3 -1
- package/dist/{processor-JHR3Z42W.js → processor-3YZVK4JT.js} +4 -4
- package/dist/{project-creator-6DU7E75S.js → project-creator-BDDFQM6G.js} +2 -2
- package/dist/{projects-2HYIZC4Y.js → projects-VO4PMVZY.js} +2 -2
- package/dist/{serve-AV74ODQ6.js → serve-CRZ7NHSP.js} +6 -6
- package/dist/server/index.js +5 -5
- package/dist/{server-P7E2IPVL.js → server-JKNV2NCJ.js} +5 -5
- package/dist/{tools-WEE4XDTL.js → tools-YWC3AJ66.js} +3 -3
- package/dist/web/assets/{index-Ho_tVUbw.css → index-Bq9rJ9jH.css} +1 -1
- package/dist/web/assets/{index-BMz5-yAf.js → index-e6TyhL8M.js} +53 -53
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +3 -1
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "./chunk-J7KOV4ST.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-MS3PEYZK.js";
|
|
12
|
+
import "./chunk-KYR4NVNX.js";
|
|
13
|
+
import "./chunk-O4TED6AJ.js";
|
|
14
14
|
import "./chunk-L7TDUIQY.js";
|
|
15
15
|
import "./chunk-DL6ZILAF.js";
|
|
16
16
|
import "./chunk-PBGOZMVY.js";
|
|
@@ -164,4 +164,4 @@ export {
|
|
|
164
164
|
startChatSession,
|
|
165
165
|
stopSessionExecution
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=chat-handler-
|
|
167
|
+
//# sourceMappingURL=chat-handler-DTMB43CD.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
injectWorkflowKickoffIfNeeded,
|
|
6
6
|
runAgentTurn,
|
|
7
7
|
runChatTurn
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MS3PEYZK.js";
|
|
9
9
|
import {
|
|
10
10
|
applyDynamicContext,
|
|
11
11
|
checkAborted,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
loadAllAgentsDefault,
|
|
23
23
|
saveItemToDir,
|
|
24
24
|
spawnShellProcess
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KYR4NVNX.js";
|
|
26
26
|
import {
|
|
27
27
|
TurnMetrics,
|
|
28
28
|
createMessageStartEvent
|
|
@@ -1775,7 +1775,7 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1775
1775
|
const runtimeConfig = getRuntimeConfig();
|
|
1776
1776
|
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
1777
1777
|
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
1778
|
-
const { createToolRegistry } = await import("./tools-
|
|
1778
|
+
const { createToolRegistry } = await import("./tools-YWC3AJ66.js");
|
|
1779
1779
|
const allTools = createToolRegistry().definitions;
|
|
1780
1780
|
const toolFingerprint = getToolFingerprint(allTools);
|
|
1781
1781
|
const currentHash = computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -1848,7 +1848,7 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1848
1848
|
const runtimeConfig = getRuntimeConfig();
|
|
1849
1849
|
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
1850
1850
|
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
1851
|
-
const { createToolRegistry } = await import("./tools-
|
|
1851
|
+
const { createToolRegistry } = await import("./tools-YWC3AJ66.js");
|
|
1852
1852
|
const allTools = createToolRegistry().definitions;
|
|
1853
1853
|
const toolFingerprint = getToolFingerprint(allTools);
|
|
1854
1854
|
const currentHash = computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -2069,4 +2069,4 @@ export {
|
|
|
2069
2069
|
signalMcpReady,
|
|
2070
2070
|
createWebSocketServer
|
|
2071
2071
|
};
|
|
2072
|
-
//# sourceMappingURL=chunk-
|
|
2072
|
+
//# sourceMappingURL=chunk-5ANV7YUX.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
tokenFromPassword,
|
|
22
22
|
verifyPassword,
|
|
23
23
|
workflowExists
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-5ANV7YUX.js";
|
|
25
25
|
import {
|
|
26
26
|
agentExists,
|
|
27
27
|
createToolRegistry,
|
|
@@ -61,10 +61,10 @@ import {
|
|
|
61
61
|
setMcpTools,
|
|
62
62
|
setNotifyMcpServersChanged,
|
|
63
63
|
skillExists
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-KYR4NVNX.js";
|
|
65
65
|
import {
|
|
66
66
|
getProject
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-O4TED6AJ.js";
|
|
68
68
|
import {
|
|
69
69
|
getPathSeparator,
|
|
70
70
|
isAbsolutePath
|
|
@@ -3944,7 +3944,7 @@ import { Router as Router6 } from "express";
|
|
|
3944
3944
|
import { spawn as spawn2 } from "child_process";
|
|
3945
3945
|
|
|
3946
3946
|
// src/constants.ts
|
|
3947
|
-
var VERSION = "2.0.
|
|
3947
|
+
var VERSION = "2.0.17";
|
|
3948
3948
|
|
|
3949
3949
|
// src/server/routes/auto-update.ts
|
|
3950
3950
|
var updateInProgress = false;
|
|
@@ -4124,7 +4124,7 @@ async function createServerHandle(config4) {
|
|
|
4124
4124
|
setMcpTools(mcpTools);
|
|
4125
4125
|
logger.info("MCP tools registered", { count: mcpTools.length });
|
|
4126
4126
|
}
|
|
4127
|
-
const { signalMcpReady } = await import("./server-
|
|
4127
|
+
const { signalMcpReady } = await import("./server-JKNV2NCJ.js");
|
|
4128
4128
|
signalMcpReady();
|
|
4129
4129
|
});
|
|
4130
4130
|
const app = express();
|
|
@@ -4184,7 +4184,7 @@ async function createServerHandle(config4) {
|
|
|
4184
4184
|
res.json({ tools });
|
|
4185
4185
|
});
|
|
4186
4186
|
app.get("/api/projects", async (_req, res) => {
|
|
4187
|
-
const { listProjects } = await import("./projects-
|
|
4187
|
+
const { listProjects } = await import("./projects-VO4PMVZY.js");
|
|
4188
4188
|
const projects = listProjects();
|
|
4189
4189
|
res.json({ projects });
|
|
4190
4190
|
});
|
|
@@ -4193,7 +4193,7 @@ async function createServerHandle(config4) {
|
|
|
4193
4193
|
if (!name || !workdir) {
|
|
4194
4194
|
return res.status(400).json({ error: "name and workdir are required" });
|
|
4195
4195
|
}
|
|
4196
|
-
const { createDirectoryWithGit } = await import("./project-creator-
|
|
4196
|
+
const { createDirectoryWithGit } = await import("./project-creator-BDDFQM6G.js");
|
|
4197
4197
|
try {
|
|
4198
4198
|
const project = await createDirectoryWithGit(name, workdir);
|
|
4199
4199
|
res.status(201).json({ project });
|
|
@@ -4238,7 +4238,7 @@ async function createServerHandle(config4) {
|
|
|
4238
4238
|
}
|
|
4239
4239
|
});
|
|
4240
4240
|
app.get("/api/projects/:id", async (req, res) => {
|
|
4241
|
-
const { getProject: getProject2 } = await import("./projects-
|
|
4241
|
+
const { getProject: getProject2 } = await import("./projects-VO4PMVZY.js");
|
|
4242
4242
|
const project = getProject2(req.params.id);
|
|
4243
4243
|
if (!project) {
|
|
4244
4244
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -4246,7 +4246,7 @@ async function createServerHandle(config4) {
|
|
|
4246
4246
|
res.json({ project });
|
|
4247
4247
|
});
|
|
4248
4248
|
app.put("/api/projects/:id", async (req, res) => {
|
|
4249
|
-
const { updateProject } = await import("./projects-
|
|
4249
|
+
const { updateProject } = await import("./projects-VO4PMVZY.js");
|
|
4250
4250
|
const { name, customInstructions, dangerLevel } = req.body;
|
|
4251
4251
|
const updates = {};
|
|
4252
4252
|
if (name !== void 0) updates.name = name;
|
|
@@ -4259,7 +4259,7 @@ async function createServerHandle(config4) {
|
|
|
4259
4259
|
res.json({ project: updated });
|
|
4260
4260
|
});
|
|
4261
4261
|
app.delete("/api/projects/:id", async (req, res) => {
|
|
4262
|
-
const { getProject: getProject2, deleteProject } = await import("./projects-
|
|
4262
|
+
const { getProject: getProject2, deleteProject } = await import("./projects-VO4PMVZY.js");
|
|
4263
4263
|
const project = getProject2(req.params.id);
|
|
4264
4264
|
if (!project) {
|
|
4265
4265
|
return res.status(404).json({ error: "Project not found" });
|
|
@@ -4268,7 +4268,7 @@ async function createServerHandle(config4) {
|
|
|
4268
4268
|
res.json({ success: true });
|
|
4269
4269
|
});
|
|
4270
4270
|
app.put("/api/projects/:id/star", async (req, res) => {
|
|
4271
|
-
const { toggleStar } = await import("./projects-
|
|
4271
|
+
const { toggleStar } = await import("./projects-VO4PMVZY.js");
|
|
4272
4272
|
const { isStarred } = req.body;
|
|
4273
4273
|
if (typeof isStarred !== "boolean") {
|
|
4274
4274
|
return res.status(400).json({ error: "isStarred is required and must be a boolean" });
|
|
@@ -4315,7 +4315,7 @@ async function createServerHandle(config4) {
|
|
|
4315
4315
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
4316
4316
|
const { getEventStore: getEventStore2 } = await import("./events-4K52FKPR.js");
|
|
4317
4317
|
const { buildMessagesFromStoredEvents } = await import("./folding-QIBNKYA6.js");
|
|
4318
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4318
|
+
const { getPendingQuestionsForSession } = await import("./tools-YWC3AJ66.js");
|
|
4319
4319
|
const session = sessionManager.getSession(req.params.id);
|
|
4320
4320
|
if (!session) {
|
|
4321
4321
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -4446,7 +4446,7 @@ async function createServerHandle(config4) {
|
|
|
4446
4446
|
if (!callId || approved === void 0) {
|
|
4447
4447
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
4448
4448
|
}
|
|
4449
|
-
const { providePathConfirmation } = await import("./tools-
|
|
4449
|
+
const { providePathConfirmation } = await import("./tools-YWC3AJ66.js");
|
|
4450
4450
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
4451
4451
|
if (!result.found) {
|
|
4452
4452
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
@@ -4454,7 +4454,7 @@ async function createServerHandle(config4) {
|
|
|
4454
4454
|
const { getEventStore: getEventStore2 } = await import("./events-4K52FKPR.js");
|
|
4455
4455
|
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-QIBNKYA6.js");
|
|
4456
4456
|
const { createSessionStateMessage } = await import("./protocol-BKNLAEPJ.js");
|
|
4457
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4457
|
+
const { getPendingQuestionsForSession } = await import("./tools-YWC3AJ66.js");
|
|
4458
4458
|
const eventStore = getEventStore2();
|
|
4459
4459
|
const events = eventStore.getEvents(sessionId);
|
|
4460
4460
|
const messages = buildMessagesFromStoredEvents(events);
|
|
@@ -4475,7 +4475,7 @@ async function createServerHandle(config4) {
|
|
|
4475
4475
|
if (!skip && typeof answer !== "string") {
|
|
4476
4476
|
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
4477
4477
|
}
|
|
4478
|
-
const { provideAnswer } = await import("./tools-
|
|
4478
|
+
const { provideAnswer } = await import("./tools-YWC3AJ66.js");
|
|
4479
4479
|
const found = provideAnswer(callId, answer ?? "", skip ?? false);
|
|
4480
4480
|
if (!found) {
|
|
4481
4481
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -4511,8 +4511,8 @@ async function createServerHandle(config4) {
|
|
|
4511
4511
|
if (!session) {
|
|
4512
4512
|
return res.status(404).json({ error: "Session not found" });
|
|
4513
4513
|
}
|
|
4514
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
4515
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
4514
|
+
const { stopSessionExecution } = await import("./chat-handler-DTMB43CD.js");
|
|
4515
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-YWC3AJ66.js");
|
|
4516
4516
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
4517
4517
|
sessionManager.clearMessageQueue(sessionId);
|
|
4518
4518
|
stopSessionExecution(sessionId, sessionManager);
|
|
@@ -4955,7 +4955,7 @@ async function createServerHandle(config4) {
|
|
|
4955
4955
|
});
|
|
4956
4956
|
async function rebuildMcpTools() {
|
|
4957
4957
|
const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-B7QP6NLA.js");
|
|
4958
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4958
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-YWC3AJ66.js");
|
|
4959
4959
|
const mcpTools = createMcpTools2(mcpManager);
|
|
4960
4960
|
setMcpTools2(mcpTools);
|
|
4961
4961
|
}
|
|
@@ -5267,7 +5267,7 @@ async function createServerHandle(config4) {
|
|
|
5267
5267
|
const state = sessionManager.getContextState(sessionId);
|
|
5268
5268
|
wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
|
|
5269
5269
|
});
|
|
5270
|
-
const { QueueProcessor } = await import("./processor-
|
|
5270
|
+
const { QueueProcessor } = await import("./processor-3YZVK4JT.js");
|
|
5271
5271
|
const queueProcessor = new QueueProcessor({
|
|
5272
5272
|
sessionManager,
|
|
5273
5273
|
providerManager,
|
|
@@ -5342,4 +5342,4 @@ export {
|
|
|
5342
5342
|
createServerHandle,
|
|
5343
5343
|
createServer
|
|
5344
5344
|
};
|
|
5345
|
-
//# sourceMappingURL=chunk-
|
|
5345
|
+
//# sourceMappingURL=chunk-BC7R4HLY.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getProject
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O4TED6AJ.js";
|
|
4
4
|
import {
|
|
5
5
|
COMPACTION_PROMPT,
|
|
6
6
|
TurnMetrics,
|
|
@@ -609,6 +609,182 @@ function isNodeError(error) {
|
|
|
609
609
|
return error instanceof Error && "code" in error;
|
|
610
610
|
}
|
|
611
611
|
|
|
612
|
+
// src/server/utils/encoding.ts
|
|
613
|
+
import { detect } from "jschardet";
|
|
614
|
+
import * as iconv from "iconv-lite";
|
|
615
|
+
function detectEncoding(buffer) {
|
|
616
|
+
if (buffer.length === 0) {
|
|
617
|
+
return { encoding: "utf-8", confidence: 1, bomSize: 0 };
|
|
618
|
+
}
|
|
619
|
+
const bomSize = detectBOM(buffer);
|
|
620
|
+
const bomStripped = bomSize > 0 ? buffer.subarray(bomSize) : buffer;
|
|
621
|
+
if (bomSize > 0) {
|
|
622
|
+
const bomEncoding = bomEncodingForSize(buffer);
|
|
623
|
+
return { encoding: bomEncoding, confidence: 1, bomSize };
|
|
624
|
+
}
|
|
625
|
+
if (isValidUtf8(bomStripped)) {
|
|
626
|
+
return { encoding: "utf-8", confidence: 0.95, bomSize: 0 };
|
|
627
|
+
}
|
|
628
|
+
const detected = detect(bomStripped);
|
|
629
|
+
if (detected && detected.encoding && detected.confidence > 0.2) {
|
|
630
|
+
return { encoding: normalizeEncoding(detected.encoding), confidence: detected.confidence, bomSize: 0 };
|
|
631
|
+
}
|
|
632
|
+
return { encoding: "ISO-8859-1", confidence: 0.1, bomSize: 0 };
|
|
633
|
+
}
|
|
634
|
+
function detectBOM(buffer) {
|
|
635
|
+
if (buffer.length >= 4 && buffer[0] === 0 && buffer[1] === 0 && buffer[2] === 254 && buffer[3] === 255)
|
|
636
|
+
return 4;
|
|
637
|
+
if (buffer.length >= 4 && buffer[0] === 255 && buffer[1] === 254 && buffer[2] === 0 && buffer[3] === 0)
|
|
638
|
+
return 4;
|
|
639
|
+
if (buffer.length >= 2 && buffer[0] === 254 && buffer[1] === 255) return 2;
|
|
640
|
+
if (buffer.length >= 2 && buffer[0] === 255 && buffer[1] === 254) return 2;
|
|
641
|
+
if (buffer.length >= 3 && buffer[0] === 239 && buffer[1] === 187 && buffer[2] === 191) return 3;
|
|
642
|
+
return 0;
|
|
643
|
+
}
|
|
644
|
+
function bomEncodingForSize(buffer) {
|
|
645
|
+
if (buffer.length >= 2) {
|
|
646
|
+
if (buffer[0] === 254 && buffer[1] === 255) return "utf-16be";
|
|
647
|
+
if (buffer[0] === 255 && buffer[1] === 254) {
|
|
648
|
+
if (buffer.length >= 4 && buffer[2] === 0 && buffer[3] === 0) return "utf-32";
|
|
649
|
+
return "utf-16le";
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (buffer.length >= 3 && buffer[0] === 239 && buffer[1] === 187 && buffer[2] === 191) return "utf-8";
|
|
653
|
+
if (buffer.length >= 4 && buffer[0] === 0 && buffer[1] === 0 && buffer[2] === 254 && buffer[3] === 255)
|
|
654
|
+
return "utf-32be";
|
|
655
|
+
return "utf-8";
|
|
656
|
+
}
|
|
657
|
+
function isValidUtf8(buffer) {
|
|
658
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
659
|
+
try {
|
|
660
|
+
decoder.decode(buffer);
|
|
661
|
+
return true;
|
|
662
|
+
} catch {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
function normalizeEncoding(enc) {
|
|
667
|
+
const lower = enc.toLowerCase().replace(/_/g, "-");
|
|
668
|
+
const map = {
|
|
669
|
+
"utf-8": "utf-8",
|
|
670
|
+
utf8: "utf-8",
|
|
671
|
+
ascii: "utf-8",
|
|
672
|
+
"iso-8859-1": "ISO-8859-1",
|
|
673
|
+
"iso8859-1": "ISO-8859-1",
|
|
674
|
+
latin1: "ISO-8859-1",
|
|
675
|
+
"windows-1252": "windows-1252",
|
|
676
|
+
"shift-jis": "Shift_JIS",
|
|
677
|
+
shift_jis: "Shift_JIS",
|
|
678
|
+
"euc-jp": "EUC-JP",
|
|
679
|
+
"euc-kr": "EUC-KR",
|
|
680
|
+
gb2312: "GB2312",
|
|
681
|
+
gb18030: "GB18030",
|
|
682
|
+
big5: "Big5",
|
|
683
|
+
"utf-16": "utf-16le",
|
|
684
|
+
"utf-16le": "utf-16le",
|
|
685
|
+
"utf-16be": "utf-16be",
|
|
686
|
+
"utf-32": "utf-32le",
|
|
687
|
+
"utf-32le": "utf-32le",
|
|
688
|
+
"utf-32be": "utf-32be",
|
|
689
|
+
"koi8-r": "KOI8-R",
|
|
690
|
+
"koi8-u": "KOI8-U"
|
|
691
|
+
};
|
|
692
|
+
return map[lower] ?? enc;
|
|
693
|
+
}
|
|
694
|
+
function decodeContent(buffer, encoding) {
|
|
695
|
+
const bomSize = detectBOM(buffer);
|
|
696
|
+
const contentBuf = bomSize > 0 ? buffer.subarray(bomSize) : buffer;
|
|
697
|
+
const normalized = normalizeEncoding(encoding);
|
|
698
|
+
if (normalized === "utf-8") {
|
|
699
|
+
return contentBuf.toString("utf-8");
|
|
700
|
+
}
|
|
701
|
+
if (normalized === "utf-16le") {
|
|
702
|
+
return contentBuf.toString("utf-16le");
|
|
703
|
+
}
|
|
704
|
+
if (normalized === "utf-16be") {
|
|
705
|
+
return swapUtf16Endianness(contentBuf).toString("utf-16le");
|
|
706
|
+
}
|
|
707
|
+
if (normalized === "utf-32le") {
|
|
708
|
+
return utf32ToString(contentBuf, true);
|
|
709
|
+
}
|
|
710
|
+
if (normalized === "utf-32be") {
|
|
711
|
+
return utf32ToString(contentBuf, false);
|
|
712
|
+
}
|
|
713
|
+
return iconv.decode(contentBuf, normalized);
|
|
714
|
+
}
|
|
715
|
+
function encodeContent(content, encoding, addBom = false) {
|
|
716
|
+
const normalized = normalizeEncoding(encoding);
|
|
717
|
+
let encoded;
|
|
718
|
+
if (normalized === "utf-8") {
|
|
719
|
+
encoded = Buffer.from(content, "utf-8");
|
|
720
|
+
} else if (normalized === "utf-16le") {
|
|
721
|
+
encoded = Buffer.from(content, "utf-16le");
|
|
722
|
+
} else if (normalized === "utf-16be") {
|
|
723
|
+
encoded = swapUtf16Endianness(Buffer.from(content, "utf-16le"));
|
|
724
|
+
} else if (normalized === "utf-32le") {
|
|
725
|
+
encoded = stringToUtf32(content, true);
|
|
726
|
+
} else if (normalized === "utf-32be") {
|
|
727
|
+
encoded = stringToUtf32(content, false);
|
|
728
|
+
} else {
|
|
729
|
+
encoded = iconv.encode(content, normalized);
|
|
730
|
+
}
|
|
731
|
+
if (addBom) {
|
|
732
|
+
const bom = bomForEncoding(normalized);
|
|
733
|
+
if (bom) {
|
|
734
|
+
encoded = Buffer.concat([bom, encoded]);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return encoded;
|
|
738
|
+
}
|
|
739
|
+
function bomForEncoding(encoding) {
|
|
740
|
+
switch (encoding) {
|
|
741
|
+
case "utf-8":
|
|
742
|
+
return Buffer.from([239, 187, 191]);
|
|
743
|
+
case "utf-16le":
|
|
744
|
+
return Buffer.from([255, 254]);
|
|
745
|
+
case "utf-16be":
|
|
746
|
+
return Buffer.from([254, 255]);
|
|
747
|
+
case "utf-32le":
|
|
748
|
+
return Buffer.from([255, 254, 0, 0]);
|
|
749
|
+
case "utf-32be":
|
|
750
|
+
return Buffer.from([0, 0, 254, 255]);
|
|
751
|
+
default:
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
function swapUtf16Endianness(buf) {
|
|
756
|
+
const out = Buffer.alloc(buf.length);
|
|
757
|
+
for (let i = 0; i + 1 < buf.length; i += 2) {
|
|
758
|
+
out[i] = buf[i + 1];
|
|
759
|
+
out[i + 1] = buf[i];
|
|
760
|
+
}
|
|
761
|
+
return out;
|
|
762
|
+
}
|
|
763
|
+
function utf32ToString(buffer, littleEndian) {
|
|
764
|
+
const chars = [];
|
|
765
|
+
for (let i = 0; i + 3 < buffer.length; i += 4) {
|
|
766
|
+
const code = littleEndian ? buffer.readUInt32LE(i) : buffer.readUInt32BE(i);
|
|
767
|
+
if (code > 1114111) continue;
|
|
768
|
+
chars.push(String.fromCodePoint(code));
|
|
769
|
+
}
|
|
770
|
+
return chars.join("");
|
|
771
|
+
}
|
|
772
|
+
function stringToUtf32(str, littleEndian) {
|
|
773
|
+
const codes = [];
|
|
774
|
+
for (const ch of str) {
|
|
775
|
+
codes.push(ch.codePointAt(0));
|
|
776
|
+
}
|
|
777
|
+
const buf = Buffer.alloc(codes.length * 4);
|
|
778
|
+
for (let i = 0; i < codes.length; i++) {
|
|
779
|
+
if (littleEndian) {
|
|
780
|
+
buf.writeUInt32LE(codes[i], i * 4);
|
|
781
|
+
} else {
|
|
782
|
+
buf.writeUInt32BE(codes[i], i * 4);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return buf;
|
|
786
|
+
}
|
|
787
|
+
|
|
612
788
|
// src/server/tools/read.ts
|
|
613
789
|
var IMAGE_MIME_TYPES = {
|
|
614
790
|
".png": "image/png",
|
|
@@ -759,7 +935,8 @@ var readFileTool = createTool(
|
|
|
759
935
|
}
|
|
760
936
|
});
|
|
761
937
|
}
|
|
762
|
-
const
|
|
938
|
+
const { encoding, confidence } = detectEncoding(rawBuffer);
|
|
939
|
+
const content = decodeContent(rawBuffer, encoding);
|
|
763
940
|
const lines = content.split("\n");
|
|
764
941
|
const totalLines = lines.length;
|
|
765
942
|
const startLine = Math.max(1, offset);
|
|
@@ -781,7 +958,13 @@ var readFileTool = createTool(
|
|
|
781
958
|
if (contentHash2) {
|
|
782
959
|
context.sessionManager.recordFileRead(context.sessionId, fullPath, contentHash2);
|
|
783
960
|
}
|
|
784
|
-
return helpers.success(output, truncated
|
|
961
|
+
return helpers.success(output, truncated, {
|
|
962
|
+
metadata: {
|
|
963
|
+
encoding,
|
|
964
|
+
confidence: Math.round(confidence * 100) / 100,
|
|
965
|
+
lineCount: totalLines
|
|
966
|
+
}
|
|
967
|
+
});
|
|
785
968
|
}
|
|
786
969
|
);
|
|
787
970
|
|
|
@@ -840,6 +1023,10 @@ var writeFileTool = createTool(
|
|
|
840
1023
|
content: {
|
|
841
1024
|
type: "string",
|
|
842
1025
|
description: "Content to write to the file"
|
|
1026
|
+
},
|
|
1027
|
+
encoding: {
|
|
1028
|
+
type: "string",
|
|
1029
|
+
description: 'Optional file encoding (e.g. "ISO-8859-1", "windows-1252", "utf-16"). Defaults to "utf-8". Use the encoding reported by read_file to match project conventions.'
|
|
843
1030
|
}
|
|
844
1031
|
},
|
|
845
1032
|
required: ["path", "content"]
|
|
@@ -856,9 +1043,11 @@ var writeFileTool = createTool(
|
|
|
856
1043
|
}
|
|
857
1044
|
const dir = dirname(fullPath);
|
|
858
1045
|
await mkdir(dir, { recursive: true });
|
|
859
|
-
|
|
1046
|
+
const encoding = args.encoding ?? "utf-8";
|
|
1047
|
+
const encoded = encodeContent(args.content, encoding);
|
|
1048
|
+
await writeFile(fullPath, encoded);
|
|
860
1049
|
const lineCount = args.content.split("\n").length;
|
|
861
|
-
const byteCount =
|
|
1050
|
+
const byteCount = encoded.length;
|
|
862
1051
|
let output = `Successfully wrote ${lineCount} lines (${byteCount} bytes) to ${args.path}`;
|
|
863
1052
|
let diagnostics = [];
|
|
864
1053
|
if (context.lspManager) {
|
|
@@ -1045,12 +1234,14 @@ var editFileTool = createTool(
|
|
|
1045
1234
|
if (!validation.valid) {
|
|
1046
1235
|
return helpers.error(validation.error?.message ?? "File validation failed");
|
|
1047
1236
|
}
|
|
1048
|
-
let
|
|
1237
|
+
let rawBuffer;
|
|
1049
1238
|
try {
|
|
1050
|
-
|
|
1239
|
+
rawBuffer = await readFile3(fullPath);
|
|
1051
1240
|
} catch {
|
|
1052
1241
|
return helpers.error(`File not found: ${args.path}`);
|
|
1053
1242
|
}
|
|
1243
|
+
const { encoding, bomSize } = detectEncoding(rawBuffer);
|
|
1244
|
+
const content = decodeContent(rawBuffer, encoding);
|
|
1054
1245
|
const fileLineEnding = detectLineEnding(content);
|
|
1055
1246
|
const normalizedContent = normalizeToLF(content);
|
|
1056
1247
|
const normalizedOldString = normalizeToLF(args.old_string);
|
|
@@ -1108,15 +1299,16 @@ Make sure whitespace and indentation match exactly.`
|
|
|
1108
1299
|
}
|
|
1109
1300
|
replacedContent = normalizedContent.slice(0, index) + normalizedNewString + normalizedContent.slice(index + normalizedOldString.length);
|
|
1110
1301
|
}
|
|
1111
|
-
const
|
|
1302
|
+
const restoredContent = replacedContent.replace(
|
|
1112
1303
|
/\n/g,
|
|
1113
1304
|
fileLineEnding === "crlf" ? "\r\n" : fileLineEnding === "cr" ? "\r" : "\n"
|
|
1114
1305
|
);
|
|
1115
|
-
|
|
1306
|
+
const encoded = encodeContent(restoredContent, encoding, bomSize > 0);
|
|
1307
|
+
await writeFile2(fullPath, encoded);
|
|
1116
1308
|
let output = `Successfully replaced ${replaceAll ? occurrences : 1} occurrence(s) in ${args.path}`;
|
|
1117
1309
|
let diagnostics = [];
|
|
1118
1310
|
if (context.lspManager) {
|
|
1119
|
-
diagnostics = await context.lspManager.notifyFileChange(fullPath,
|
|
1311
|
+
diagnostics = await context.lspManager.notifyFileChange(fullPath, restoredContent);
|
|
1120
1312
|
output += formatDiagnosticsForLLM(diagnostics);
|
|
1121
1313
|
output = appendLspInstallHint(output, context.lspManager, fullPath);
|
|
1122
1314
|
}
|
|
@@ -3149,7 +3341,7 @@ var callSubAgentTool = {
|
|
|
3149
3341
|
};
|
|
3150
3342
|
}
|
|
3151
3343
|
try {
|
|
3152
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3344
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-YWC3AJ66.js");
|
|
3153
3345
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3154
3346
|
const turnMetrics = new TurnMetrics();
|
|
3155
3347
|
const result = await executeSubAgent({
|
|
@@ -3955,7 +4147,7 @@ async function computeContextHash(sessionManager, sessionId) {
|
|
|
3955
4147
|
const runtimeConfig = getRuntimeConfig();
|
|
3956
4148
|
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
3957
4149
|
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
3958
|
-
const { createToolRegistry: createToolRegistry2 } = await import("./tools-
|
|
4150
|
+
const { createToolRegistry: createToolRegistry2 } = await import("./tools-YWC3AJ66.js");
|
|
3959
4151
|
const allTools = createToolRegistry2().definitions;
|
|
3960
4152
|
const toolFingerprint = getToolFingerprint(allTools);
|
|
3961
4153
|
const hash = computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -4068,7 +4260,7 @@ var mcpConfigTool = createTool(
|
|
|
4068
4260
|
await saveGlobalConfig(mcpConfigMode, { ...globalConfig, mcpServers: updated });
|
|
4069
4261
|
}
|
|
4070
4262
|
async function rebuildTools() {
|
|
4071
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4263
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-YWC3AJ66.js");
|
|
4072
4264
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
4073
4265
|
setMcpTools2(mcpTools);
|
|
4074
4266
|
}
|
|
@@ -4448,4 +4640,4 @@ export {
|
|
|
4448
4640
|
getToolRegistryForAgent,
|
|
4449
4641
|
createToolRegistry
|
|
4450
4642
|
};
|
|
4451
|
-
//# sourceMappingURL=chunk-
|
|
4643
|
+
//# sourceMappingURL=chunk-KYR4NVNX.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
processEventsForConversation,
|
|
16
16
|
runTopLevelAgentLoop
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KYR4NVNX.js";
|
|
18
18
|
import {
|
|
19
19
|
TurnMetrics,
|
|
20
20
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -320,4 +320,4 @@ export {
|
|
|
320
320
|
runAgentTurn,
|
|
321
321
|
injectWorkflowKickoffIfNeeded
|
|
322
322
|
};
|
|
323
|
-
//# sourceMappingURL=chunk-
|
|
323
|
+
//# sourceMappingURL=chunk-MS3PEYZK.js.map
|
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
// src/server/db/projects.ts
|
|
6
6
|
function createProject(name, workdir) {
|
|
7
7
|
const db = getDatabase();
|
|
8
|
+
const existing = getProjectByWorkdir(workdir);
|
|
9
|
+
if (existing) {
|
|
10
|
+
return existing;
|
|
11
|
+
}
|
|
8
12
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
9
13
|
const id = crypto.randomUUID();
|
|
10
14
|
db.prepare(
|
|
@@ -113,4 +117,4 @@ export {
|
|
|
113
117
|
deleteProject,
|
|
114
118
|
toggleStar
|
|
115
119
|
};
|
|
116
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-O4TED6AJ.js.map
|
|
@@ -196,7 +196,7 @@ async function runCli(options) {
|
|
|
196
196
|
if (!configExists) {
|
|
197
197
|
await runNetworkSetup(mode);
|
|
198
198
|
}
|
|
199
|
-
const { runServe } = await import("./serve-
|
|
199
|
+
const { runServe } = await import("./serve-CRZ7NHSP.js");
|
|
200
200
|
const serveOptions = { mode };
|
|
201
201
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
202
202
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -208,4 +208,4 @@ async function runCli(options) {
|
|
|
208
208
|
export {
|
|
209
209
|
runCli
|
|
210
210
|
};
|
|
211
|
-
//# sourceMappingURL=chunk-
|
|
211
|
+
//# sourceMappingURL=chunk-YGNOTMV7.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-MS3PEYZK.js";
|
|
6
|
+
import "./chunk-KYR4NVNX.js";
|
|
7
|
+
import "./chunk-O4TED6AJ.js";
|
|
8
8
|
import {
|
|
9
9
|
TurnMetrics,
|
|
10
10
|
createChatDoneEvent,
|
|
@@ -39,4 +39,4 @@ export {
|
|
|
39
39
|
runAgentTurn,
|
|
40
40
|
runChatTurn
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=orchestrator-
|
|
42
|
+
//# sourceMappingURL=orchestrator-FNAU26B6.js.map
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openfox",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.17",
|
|
4
4
|
"description": "Local-LLM-first agentic coding assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -71,7 +71,9 @@
|
|
|
71
71
|
"gray-matter": "^4.0.3",
|
|
72
72
|
"html2canvas": "^1.4.1",
|
|
73
73
|
"http-proxy": "^1.18.1",
|
|
74
|
+
"iconv-lite": "^0.7.2",
|
|
74
75
|
"ignore": "^7.0.5",
|
|
76
|
+
"jschardet": "^3.1.4",
|
|
75
77
|
"node-pty": "^1.2.0-beta.12",
|
|
76
78
|
"open": "^11.0.0",
|
|
77
79
|
"openai": "^6.33.0",
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
8
|
} from "./chunk-J7KOV4ST.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-KYR4NVNX.js";
|
|
10
|
+
import "./chunk-O4TED6AJ.js";
|
|
11
11
|
import "./chunk-L7TDUIQY.js";
|
|
12
12
|
import "./chunk-DL6ZILAF.js";
|
|
13
13
|
import "./chunk-PBGOZMVY.js";
|
|
@@ -193,7 +193,7 @@ var QueueProcessor = class {
|
|
|
193
193
|
backend: provider?.backend ?? llmClient.getBackend(),
|
|
194
194
|
model: llmClient.getModel()
|
|
195
195
|
};
|
|
196
|
-
const { runChatTurn } = await import("./orchestrator-
|
|
196
|
+
const { runChatTurn } = await import("./orchestrator-FNAU26B6.js");
|
|
197
197
|
const runChatTurnParams = buildRunChatTurnParams({
|
|
198
198
|
sessionManager,
|
|
199
199
|
sessionId,
|
|
@@ -241,4 +241,4 @@ var QueueProcessor = class {
|
|
|
241
241
|
export {
|
|
242
242
|
QueueProcessor
|
|
243
243
|
};
|
|
244
|
-
//# sourceMappingURL=processor-
|
|
244
|
+
//# sourceMappingURL=processor-3YZVK4JT.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProject
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O4TED6AJ.js";
|
|
4
4
|
import "./chunk-FBGWG4N6.js";
|
|
5
5
|
import "./chunk-K44MW7JJ.js";
|
|
6
6
|
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
createDirectoryWithGit,
|
|
109
109
|
validateProjectName
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=project-creator-
|
|
111
|
+
//# sourceMappingURL=project-creator-BDDFQM6G.js.map
|