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,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAllInstructions,
|
|
3
|
+
getEnabledSkillMetadata
|
|
4
|
+
} from "./chunk-SXHGRPCI.js";
|
|
5
|
+
import {
|
|
6
|
+
buildTopLevelSystemPrompt
|
|
7
|
+
} from "./chunk-NLJXZZTB.js";
|
|
8
|
+
import {
|
|
9
|
+
findAgentById,
|
|
10
|
+
getRuntimeConfig,
|
|
11
|
+
getSubAgents,
|
|
12
|
+
loadAllAgentsDefault,
|
|
13
|
+
resolveDefaultAgentId
|
|
14
|
+
} from "./chunk-NGN3Q26A.js";
|
|
15
|
+
import {
|
|
16
|
+
logger
|
|
17
|
+
} from "./chunk-K44MW7JJ.js";
|
|
18
|
+
import {
|
|
19
|
+
getGlobalConfigDir
|
|
20
|
+
} from "./chunk-CQGTEGKL.js";
|
|
21
|
+
|
|
22
|
+
// src/server/chat/dynamic-context.ts
|
|
23
|
+
import { createHash } from "crypto";
|
|
24
|
+
function computeUnifiedDiff(oldText, newText) {
|
|
25
|
+
const oldLines = oldText.length === 0 ? [] : oldText.split("\n");
|
|
26
|
+
const newLines = newText.length === 0 ? [] : newText.split("\n");
|
|
27
|
+
const result = [];
|
|
28
|
+
if (oldText === newText) {
|
|
29
|
+
return oldLines.map((line) => ({ type: "unchanged", content: line }));
|
|
30
|
+
}
|
|
31
|
+
const lcs = /* @__PURE__ */ new Map();
|
|
32
|
+
for (let i2 = 0; i2 <= oldLines.length; i2++) {
|
|
33
|
+
lcs.set(i2, /* @__PURE__ */ new Map());
|
|
34
|
+
for (let j2 = 0; j2 <= newLines.length; j2++) {
|
|
35
|
+
lcs.get(i2).set(j2, 0);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (let i2 = 1; i2 <= oldLines.length; i2++) {
|
|
39
|
+
for (let j2 = 1; j2 <= newLines.length; j2++) {
|
|
40
|
+
const oldLine = oldLines[i2 - 1];
|
|
41
|
+
const newLine = newLines[j2 - 1];
|
|
42
|
+
if (oldLine === newLine) {
|
|
43
|
+
lcs.get(i2).set(j2, (lcs.get(i2 - 1).get(j2 - 1) ?? 0) + 1);
|
|
44
|
+
} else {
|
|
45
|
+
const up = lcs.get(i2 - 1).get(j2) ?? 0;
|
|
46
|
+
const left = lcs.get(i2).get(j2 - 1) ?? 0;
|
|
47
|
+
lcs.get(i2).set(j2, Math.max(up, left));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let i = oldLines.length;
|
|
52
|
+
let j = newLines.length;
|
|
53
|
+
while (i > 0 || j > 0) {
|
|
54
|
+
const oldLine = oldLines[i - 1] ?? "";
|
|
55
|
+
const newLine = newLines[j - 1] ?? "";
|
|
56
|
+
if (i > 0 && j > 0 && oldLine === newLine) {
|
|
57
|
+
result.unshift({ type: "unchanged", content: oldLine });
|
|
58
|
+
i--;
|
|
59
|
+
j--;
|
|
60
|
+
} else if (i > 0 && j > 0) {
|
|
61
|
+
const lcsIM1J = lcs.get(i - 1)?.get(j) ?? 0;
|
|
62
|
+
const lcsIJM1 = lcs.get(i)?.get(j - 1) ?? 0;
|
|
63
|
+
if (lcsIM1J > lcsIJM1) {
|
|
64
|
+
result.unshift({ type: "removed", content: oldLine });
|
|
65
|
+
i--;
|
|
66
|
+
} else {
|
|
67
|
+
result.unshift({ type: "added", content: newLine });
|
|
68
|
+
j--;
|
|
69
|
+
}
|
|
70
|
+
} else if (i > 0) {
|
|
71
|
+
result.unshift({ type: "removed", content: oldLine });
|
|
72
|
+
i--;
|
|
73
|
+
} else {
|
|
74
|
+
result.unshift({ type: "added", content: newLine });
|
|
75
|
+
j--;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
function computeDynamicContextHash(instructionContent, skills, toolFingerprint) {
|
|
81
|
+
const dynamicInputs = JSON.stringify({
|
|
82
|
+
instructions: instructionContent,
|
|
83
|
+
skills: skills.map((s) => s.id).sort(),
|
|
84
|
+
...toolFingerprint ? { tools: toolFingerprint } : {}
|
|
85
|
+
});
|
|
86
|
+
return createHash("sha256").update(dynamicInputs).digest("hex");
|
|
87
|
+
}
|
|
88
|
+
function getToolFingerprint(tools) {
|
|
89
|
+
return tools.map((t) => `${t.function.name}:${JSON.stringify(t.function.parameters)}`).sort().join("|");
|
|
90
|
+
}
|
|
91
|
+
async function loadSessionContext(sessionManager, sessionId) {
|
|
92
|
+
const session = sessionManager.requireSession(sessionId);
|
|
93
|
+
const { content: instructionContent } = await getAllInstructions(session.workdir, session.projectId);
|
|
94
|
+
const runtimeConfig = getRuntimeConfig();
|
|
95
|
+
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
96
|
+
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
97
|
+
return { instructionContent: instructionContent ?? "", skills };
|
|
98
|
+
}
|
|
99
|
+
function resolveAgentDef(sessionManager, sessionId) {
|
|
100
|
+
return loadAllAgentsDefault().then((allAgents) => {
|
|
101
|
+
const session = sessionManager.requireSession(sessionId);
|
|
102
|
+
return findAgentById(session.mode, allAgents) ?? findAgentById(resolveDefaultAgentId(), allAgents);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
106
|
+
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
107
|
+
const { getToolRegistryForAgent } = await import("./tools-DXBIHSMY.js");
|
|
108
|
+
const tools = getToolRegistryForAgent(agentDef, sessionId).definitions;
|
|
109
|
+
const toolFingerprint = getToolFingerprint(tools);
|
|
110
|
+
const allAgents = await loadAllAgentsDefault();
|
|
111
|
+
const subAgentDefs = getSubAgents(allAgents);
|
|
112
|
+
const session = sessionManager.requireSession(sessionId);
|
|
113
|
+
const systemPrompt = buildTopLevelSystemPrompt(session.workdir, instructionContent || void 0, skills, subAgentDefs);
|
|
114
|
+
const hash = computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
115
|
+
return { systemPrompt, tools, hash };
|
|
116
|
+
}
|
|
117
|
+
async function computeSessionHash(sessionManager, sessionId) {
|
|
118
|
+
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
119
|
+
const agentDef = await resolveAgentDef(sessionManager, sessionId);
|
|
120
|
+
const { getToolRegistryForAgent } = await import("./tools-DXBIHSMY.js");
|
|
121
|
+
const tools = getToolRegistryForAgent(agentDef, sessionId).definitions;
|
|
122
|
+
const toolFingerprint = getToolFingerprint(tools);
|
|
123
|
+
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
124
|
+
}
|
|
125
|
+
async function applyDynamicContext(sessionManager, sessionId) {
|
|
126
|
+
const session = sessionManager.requireSession(sessionId);
|
|
127
|
+
const allAgents = await loadAllAgentsDefault();
|
|
128
|
+
const agentDef = findAgentById(session.mode, allAgents) ?? findAgentById(resolveDefaultAgentId(), allAgents);
|
|
129
|
+
const { systemPrompt, tools, hash } = await buildCachedPrompt(sessionManager, sessionId, agentDef);
|
|
130
|
+
sessionManager.setCachedPrompt(sessionId, systemPrompt, tools, hash);
|
|
131
|
+
sessionManager.setDynamicContextChanged(sessionId, false);
|
|
132
|
+
sessionManager.clearDebugDump(sessionId);
|
|
133
|
+
logger.debug("applyDynamicContext done", { sessionId, hash, toolCount: tools.length });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export {
|
|
137
|
+
computeUnifiedDiff,
|
|
138
|
+
computeDynamicContextHash,
|
|
139
|
+
getToolFingerprint,
|
|
140
|
+
buildCachedPrompt,
|
|
141
|
+
computeSessionHash,
|
|
142
|
+
applyDynamicContext
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=chunk-FSLCOA4R.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLLMClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-C56Z4OVW.js";
|
|
4
4
|
import {
|
|
5
5
|
getModelProfile
|
|
6
6
|
} from "./chunk-V4IE7HJY.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-RMXPVQP4.js";
|
|
18
18
|
import {
|
|
19
19
|
proxyFetch
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7YBGCZSI.js";
|
|
21
21
|
import {
|
|
22
22
|
logger
|
|
23
23
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -810,4 +810,4 @@ export {
|
|
|
810
810
|
parseDefaultModelSelection,
|
|
811
811
|
createProviderManager
|
|
812
812
|
};
|
|
813
|
-
//# sourceMappingURL=chunk-
|
|
813
|
+
//# sourceMappingURL=chunk-GH5PL3JW.js.map
|