openfox 2.0.61 → 2.0.63

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 (40) hide show
  1. package/README.md +14 -0
  2. package/dist/{chat-handler-6DRGMDXZ.js → chat-handler-WNARPARQ.js} +11 -11
  3. package/dist/{chunk-KX4C5Q5J.js → chunk-5OPZLQDV.js} +196 -114
  4. package/dist/{chunk-S5DWUGKZ.js → chunk-FGG4KRFX.js} +6 -6
  5. package/dist/{chunk-ZHSCXD75.js → chunk-IVJYQZSN.js} +65 -6
  6. package/dist/{chunk-LHTVTDQQ.js → chunk-N5JF4RYJ.js} +362 -92
  7. package/dist/{chunk-GJU35MDV.js → chunk-OESYKZCM.js} +2 -2
  8. package/dist/{chunk-JKLPWTUN.js → chunk-QBYQ7KDX.js} +9 -4
  9. package/dist/{chunk-NVPVDDQZ.js → chunk-QJ5FH5DP.js} +14 -10
  10. package/dist/{chunk-H774GQJW.js → chunk-RYIREJAW.js} +234 -40
  11. package/dist/{chunk-AA4G4DGK.js → chunk-W4PUAODY.js} +34 -44
  12. package/dist/{chunk-43UFGATL.js → chunk-WGAAQASA.js} +31 -9
  13. package/dist/{chunk-6VDCH5ML.js → chunk-X5YCWKNS.js} +4 -4
  14. package/dist/cli/dev.js +1 -1
  15. package/dist/cli/index.js +1 -1
  16. package/dist/{client-KRFGMNGN.js → client-LAKW7TA5.js} +3 -3
  17. package/dist/{compactor-Q33AJPCQ.js → compactor-I3N56PSJ.js} +4 -4
  18. package/dist/{config-GMQUPNBY.js → config-EUMVEFHU.js} +2 -2
  19. package/dist/{orchestrator-AHCSLBB3.js → orchestrator-OIBLY5QJ.js} +14 -14
  20. package/dist/package.json +6 -1
  21. package/dist/{processor-45VWLZIV.js → processor-27VCKRGB.js} +13 -12
  22. package/dist/protocol-Cq66hdDX.d.ts +375 -0
  23. package/dist/provider/index.d.ts +129 -0
  24. package/dist/provider/index.js +1 -0
  25. package/dist/{provider-LBYBC5AG.js → provider-GYOW4OWQ.js} +7 -9
  26. package/dist/{provider-manager-ABEUYU3K.js → provider-manager-HRHNF73A.js} +4 -5
  27. package/dist/{serve-V44O2QE6.js → serve-HB222ARV.js} +15 -16
  28. package/dist/server/index.d.ts +5 -87
  29. package/dist/server/index.js +12 -13
  30. package/dist/{server-JDB2QVKP.js → server-XDC7R2IX.js} +10 -14
  31. package/dist/shared/index.d.ts +3 -2
  32. package/dist/{tools-7QUMO5DJ.js → tools-W2FFSF4N.js} +7 -7
  33. package/dist/types-CDZakn7f.d.ts +89 -0
  34. package/dist/{protocol-J7khRG62.d.ts → types-akHmgvBk.d.ts} +17 -373
  35. package/dist/web/assets/{index-BGkyTfuQ.css → index-DvPmgi8F.css} +1 -1
  36. package/dist/web/assets/{index-CETZPQXr.js → index-bSaZSLjg.js} +74 -73
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/sw.js +1 -1
  39. package/package.json +6 -1
  40. package/dist/chunk-M3RB4IF6.js +0 -114
@@ -1,26 +1,25 @@
1
1
  import {
2
2
  PathAccessDeniedError,
3
- buildCachedPrompt,
4
- computeDynamicContextHash,
5
3
  createAssemblyResult,
6
4
  findAgentById,
7
5
  getAllInstructions,
8
6
  getConversationMessages,
9
7
  getEnabledSkillMetadata,
10
- getToolFingerprint,
8
+ getSubAgents,
11
9
  getToolRegistryForAgent,
12
10
  loadAllAgentsDefault,
13
11
  processEventsForConversation,
14
12
  runTopLevelAgentLoop
15
- } from "./chunk-KX4C5Q5J.js";
13
+ } from "./chunk-5OPZLQDV.js";
16
14
  import {
17
15
  TurnMetrics,
18
16
  WORKFLOW_KICKOFF_PROMPT,
19
17
  buildAgentReminder,
20
18
  buildAgentSmallReminder,
19
+ buildTopLevelSystemPrompt,
21
20
  createChatDoneEvent,
22
21
  createMessageStartEvent
23
- } from "./chunk-6VDCH5ML.js";
22
+ } from "./chunk-X5YCWKNS.js";
24
23
  import {
25
24
  getCurrentContextWindowId,
26
25
  getCurrentWindowMessageOptions,
@@ -37,6 +36,64 @@ import {
37
36
  getGlobalConfigDir
38
37
  } from "./chunk-CQGTEGKL.js";
39
38
 
39
+ // src/server/chat/dynamic-context.ts
40
+ import { createHash } from "crypto";
41
+ function computeDynamicContextHash(instructionContent, skills, toolFingerprint) {
42
+ const dynamicInputs = JSON.stringify({
43
+ instructions: instructionContent,
44
+ skills: skills.map((s) => s.id).sort(),
45
+ ...toolFingerprint ? { tools: toolFingerprint } : {}
46
+ });
47
+ return createHash("sha256").update(dynamicInputs).digest("hex");
48
+ }
49
+ function getToolFingerprint(tools) {
50
+ return tools.map((t) => `${t.function.name}:${JSON.stringify(t.function.parameters)}`).sort().join("|");
51
+ }
52
+ async function loadSessionContext(sessionManager, sessionId) {
53
+ const session = sessionManager.requireSession(sessionId);
54
+ const { content: instructionContent } = await getAllInstructions(session.workdir, session.projectId);
55
+ const runtimeConfig = getRuntimeConfig();
56
+ const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
57
+ const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
58
+ return { instructionContent: instructionContent ?? "", skills };
59
+ }
60
+ function resolveAgentDef(sessionManager, sessionId) {
61
+ return loadAllAgentsDefault().then((allAgents) => {
62
+ const session = sessionManager.requireSession(sessionId);
63
+ return findAgentById(session.mode, allAgents) ?? findAgentById("planner", allAgents);
64
+ });
65
+ }
66
+ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
67
+ const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
68
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-W2FFSF4N.js");
69
+ const tools = getToolRegistryForAgent2(agentDef).definitions;
70
+ const toolFingerprint = getToolFingerprint(tools);
71
+ const allAgents = await loadAllAgentsDefault();
72
+ const subAgentDefs = getSubAgents(allAgents);
73
+ const session = sessionManager.requireSession(sessionId);
74
+ const systemPrompt = buildTopLevelSystemPrompt(session.workdir, instructionContent || void 0, skills, subAgentDefs);
75
+ const hash = computeDynamicContextHash(instructionContent, skills, toolFingerprint);
76
+ return { systemPrompt, tools, hash };
77
+ }
78
+ async function computeSessionHash(sessionManager, sessionId) {
79
+ const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
80
+ const agentDef = await resolveAgentDef(sessionManager, sessionId);
81
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-W2FFSF4N.js");
82
+ const tools = getToolRegistryForAgent2(agentDef).definitions;
83
+ const toolFingerprint = getToolFingerprint(tools);
84
+ return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
85
+ }
86
+ async function applyDynamicContext(sessionManager, sessionId) {
87
+ const session = sessionManager.requireSession(sessionId);
88
+ const allAgents = await loadAllAgentsDefault();
89
+ const agentDef = findAgentById(session.mode, allAgents) ?? findAgentById("planner", allAgents);
90
+ const { systemPrompt, tools, hash } = await buildCachedPrompt(sessionManager, sessionId, agentDef);
91
+ sessionManager.setCachedPrompt(sessionId, systemPrompt, tools, hash);
92
+ sessionManager.setDynamicContextChanged(sessionId, false);
93
+ sessionManager.clearDebugDump(sessionId);
94
+ logger.debug("applyDynamicContext done", { sessionId, hash, toolCount: tools.length });
95
+ }
96
+
40
97
  // src/server/chat/orchestrator.ts
41
98
  async function buildRetryPatterns() {
42
99
  const { getSetting, SETTINGS_KEYS } = await import("./settings-ASLTSUE2.js");
@@ -320,8 +377,10 @@ function buildSnapshot(sessionManager, sessionId, _lastStats) {
320
377
  }
321
378
 
322
379
  export {
380
+ computeSessionHash,
381
+ applyDynamicContext,
323
382
  runChatTurn,
324
383
  runAgentTurn,
325
384
  injectWorkflowKickoffIfNeeded
326
385
  };
327
- //# sourceMappingURL=chunk-ZHSCXD75.js.map
386
+ //# sourceMappingURL=chunk-IVJYQZSN.js.map