openfox 2.0.11 → 2.0.13

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.
@@ -1,13 +1,7 @@
1
1
  import {
2
2
  PathAccessDeniedError,
3
- TurnMetrics,
4
- WORKFLOW_KICKOFF_PROMPT,
5
3
  assembleAgentRequest,
6
- buildAgentReminder,
7
- buildAgentSmallReminder,
8
4
  createAssemblyResult,
9
- createChatDoneEvent,
10
- createMessageStartEvent,
11
5
  findAgentById,
12
6
  getAllInstructions,
13
7
  getConversationMessages,
@@ -17,7 +11,15 @@ import {
17
11
  loadAllAgentsDefault,
18
12
  processEventsForConversation,
19
13
  runTopLevelAgentLoop
20
- } from "./chunk-M53OBFMI.js";
14
+ } from "./chunk-2VDLXCLO.js";
15
+ import {
16
+ TurnMetrics,
17
+ WORKFLOW_KICKOFF_PROMPT,
18
+ buildAgentReminder,
19
+ buildAgentSmallReminder,
20
+ createChatDoneEvent,
21
+ createMessageStartEvent
22
+ } from "./chunk-L7TDUIQY.js";
21
23
  import {
22
24
  getCurrentContextWindowId,
23
25
  getCurrentWindowMessageOptions,
@@ -261,6 +263,7 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
261
263
  getToolRegistry: () => getToolRegistryForAgent(agentDef),
262
264
  getConversationMessages: buildGetConversationMessages(options.sessionId, options.llmClient, append),
263
265
  injectAgentReminder: () => injectAgentReminder(options.sessionId, agentDef),
266
+ ...options.initialCompacting ? { initialCompacting: true } : {},
264
267
  ...callbacks?.injectKickoff ? { injectKickoff: callbacks.injectKickoff } : {},
265
268
  ...callbacks?.onToolExecuted ? { onToolExecuted: callbacks.onToolExecuted } : {}
266
269
  },
@@ -311,4 +314,4 @@ export {
311
314
  runAgentTurn,
312
315
  injectWorkflowKickoffIfNeeded
313
316
  };
314
- //# sourceMappingURL=chunk-JUHZVYUI.js.map
317
+ //# sourceMappingURL=chunk-EZJUU54W.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-6AKAJZLV.js");
199
+ const { runServe } = await import("./serve-TJHQ326L.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-ABYYJBNO.js.map
211
+ //# sourceMappingURL=chunk-FQIT7VIA.js.map
@@ -0,0 +1,34 @@
1
+ import {
2
+ COMPACTION_PROMPT,
3
+ createMessageStartEvent
4
+ } from "./chunk-L7TDUIQY.js";
5
+ import {
6
+ getCurrentWindowMessageOptions
7
+ } from "./chunk-SYG2ENUQ.js";
8
+
9
+ // src/server/context/compactor.ts
10
+ function appendCompactionPrompt(sessionId, append) {
11
+ const compactPromptMsgId = crypto.randomUUID();
12
+ append(
13
+ createMessageStartEvent(compactPromptMsgId, "user", COMPACTION_PROMPT, {
14
+ ...getCurrentWindowMessageOptions(sessionId) ?? {},
15
+ isSystemGenerated: true,
16
+ messageKind: "auto-prompt",
17
+ metadata: { type: "compaction", name: "Compaction", color: "#64748b" }
18
+ })
19
+ );
20
+ append({ type: "message.done", data: { messageId: compactPromptMsgId } });
21
+ }
22
+ function shouldCompact(currentTokens, maxTokens, threshold) {
23
+ return currentTokens > maxTokens * threshold;
24
+ }
25
+ function getCompactionTarget(maxTokens, targetRatio) {
26
+ return Math.floor(maxTokens * targetRatio);
27
+ }
28
+
29
+ export {
30
+ appendCompactionPrompt,
31
+ shouldCompact,
32
+ getCompactionTarget
33
+ };
34
+ //# sourceMappingURL=chunk-FWJ6YXGA.js.map