openfox 2.0.31 → 2.0.33
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-Q62GBC4Z.js → chat-handler-YCFYRTFG.js} +9 -9
- package/dist/{chunk-2OU2JR6Q.js → chunk-7CGFLVUG.js} +2 -2
- package/dist/{chunk-UHWRWFLE.js → chunk-BGCDJYNU.js} +2 -2
- package/dist/{chunk-ZRKYDC4O.js → chunk-EB2RIVZA.js} +18 -28
- package/dist/{chunk-EQUVYCW5.js → chunk-IBKGV6OJ.js} +14 -29
- package/dist/{chunk-2Q46DWWO.js → chunk-IYEZ6CAW.js} +44 -52
- package/dist/{chunk-M2YRM64Q.js → chunk-JNSSFTVD.js} +2 -2
- package/dist/{chunk-SS3F2VYF.js → chunk-OSMUHB5F.js} +1 -6
- package/dist/{chunk-M7M2VH45.js → chunk-WTDCC4IP.js} +30 -2
- package/dist/{chunk-JCOLS2ZM.js → chunk-XJU2PBLN.js} +61 -68
- package/dist/{chunk-O4TED6AJ.js → chunk-YQ3SOPBI.js} +2 -2
- package/dist/{chunk-SSWRM5BT.js → chunk-ZMONCXGW.js} +3 -3
- package/dist/{chunk-FBGWG4N6.js → chunk-ZPIZLTWU.js} +13 -1
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{compactor-BN5IDIVR.js → compactor-SHEOFZDB.js} +5 -5
- package/dist/{events-F5IURVXP.js → events-YLICLPBY.js} +3 -3
- package/dist/{orchestrator-7BJEOWTX.js → orchestrator-YJV4CXKV.js} +8 -8
- package/dist/package.json +1 -1
- package/dist/{processor-AFP2CBQI.js → processor-VGVPSVGE.js} +9 -9
- package/dist/{project-creator-BDDFQM6G.js → project-creator-W6Z7KCMZ.js} +3 -3
- package/dist/{projects-VO4PMVZY.js → projects-2XSGA7JG.js} +3 -3
- package/dist/{serve-IMGECZ2I.js → serve-DU5ZDKBE.js} +11 -11
- package/dist/server/index.d.ts +0 -8
- package/dist/server/index.js +10 -10
- package/dist/{server-5Q566V7W.js → server-RHYGD2Q6.js} +10 -10
- package/dist/{settings-MMEBGS53.js → settings-MTGCEUS7.js} +3 -3
- package/dist/{tools-G3KFVM2A.js → tools-2QBZBNDL.js} +7 -7
- package/dist/web/assets/{index-DS0Hsr0z.js → index-D5CeXQdc.js} +61 -61
- package/dist/web/assets/{index-CJuwWvXr.css → index-DIvNnXne.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -199,10 +199,6 @@ function buildTopLevelSystemPrompt(workdir, customInstructions, skills, subAgent
|
|
|
199
199
|
const subAgents = subAgentDefs ? buildSubAgentsSection(subAgentDefs) : "";
|
|
200
200
|
return base + subAgents;
|
|
201
201
|
}
|
|
202
|
-
function buildSubAgentSystemPrompt(workdir, agentDef, skills, modelName) {
|
|
203
|
-
const base = buildBasePrompt(workdir, void 0, skills, modelName);
|
|
204
|
-
return base + "\n\n" + agentDef.prompt;
|
|
205
|
-
}
|
|
206
202
|
function buildToolPermissionsSection(allowedTools, isSubAgent) {
|
|
207
203
|
if (!allowedTools || allowedTools.length === 0) {
|
|
208
204
|
return "\n\n## AVAILABLE TOOLS\n\nYou have no tools available.";
|
|
@@ -692,7 +688,6 @@ export {
|
|
|
692
688
|
computeEffectiveTools,
|
|
693
689
|
buildBasePrompt,
|
|
694
690
|
buildTopLevelSystemPrompt,
|
|
695
|
-
buildSubAgentSystemPrompt,
|
|
696
691
|
buildAgentReminder,
|
|
697
692
|
buildAgentSmallReminder,
|
|
698
693
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -706,4 +701,4 @@ export {
|
|
|
706
701
|
createChatDoneEvent,
|
|
707
702
|
consumeStreamGenerator
|
|
708
703
|
};
|
|
709
|
-
//# sourceMappingURL=chunk-
|
|
704
|
+
//# sourceMappingURL=chunk-OSMUHB5F.js.map
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "./chunk-6PLAWCHQ.js";
|
|
9
9
|
import {
|
|
10
10
|
getDatabase
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZPIZLTWU.js";
|
|
12
12
|
import {
|
|
13
13
|
logger
|
|
14
14
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -790,6 +790,32 @@ function updateSessionMetadata(id, metadata) {
|
|
|
790
790
|
`
|
|
791
791
|
).run(...values);
|
|
792
792
|
}
|
|
793
|
+
function updateSessionCachedPrompt(id, systemPrompt, tools, hash) {
|
|
794
|
+
const db = getDatabase();
|
|
795
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
796
|
+
db.prepare(
|
|
797
|
+
`
|
|
798
|
+
UPDATE sessions SET cached_system_prompt = ?, cached_tools = ?, cached_hash = ?, updated_at = ? WHERE id = ?
|
|
799
|
+
`
|
|
800
|
+
).run(systemPrompt, JSON.stringify(tools), hash, now, id);
|
|
801
|
+
}
|
|
802
|
+
function getSessionCachedPrompt(id) {
|
|
803
|
+
const db = getDatabase();
|
|
804
|
+
const row = db.prepare(
|
|
805
|
+
`
|
|
806
|
+
SELECT cached_system_prompt, cached_tools, cached_hash FROM sessions WHERE id = ?
|
|
807
|
+
`
|
|
808
|
+
).get(id);
|
|
809
|
+
if (!row || !row.cached_system_prompt || !row.cached_tools || !row.cached_hash) {
|
|
810
|
+
return null;
|
|
811
|
+
}
|
|
812
|
+
try {
|
|
813
|
+
const tools = JSON.parse(row.cached_tools);
|
|
814
|
+
return { systemPrompt: row.cached_system_prompt, tools, hash: row.cached_hash };
|
|
815
|
+
} catch {
|
|
816
|
+
return null;
|
|
817
|
+
}
|
|
818
|
+
}
|
|
793
819
|
function updateSessionMessageCount(id, delta) {
|
|
794
820
|
try {
|
|
795
821
|
const db = getDatabase();
|
|
@@ -1357,6 +1383,8 @@ export {
|
|
|
1357
1383
|
updateSessionDangerLevel,
|
|
1358
1384
|
updateSessionRunning,
|
|
1359
1385
|
updateSessionMetadata,
|
|
1386
|
+
updateSessionCachedPrompt,
|
|
1387
|
+
getSessionCachedPrompt,
|
|
1360
1388
|
listSessions,
|
|
1361
1389
|
listSessionsByProject,
|
|
1362
1390
|
deleteSession,
|
|
@@ -1397,4 +1425,4 @@ export {
|
|
|
1397
1425
|
truncateSessionMessages,
|
|
1398
1426
|
getRecentUserPromptsForSession
|
|
1399
1427
|
};
|
|
1400
|
-
//# sourceMappingURL=chunk-
|
|
1428
|
+
//# sourceMappingURL=chunk-WTDCC4IP.js.map
|
|
@@ -32,15 +32,14 @@ import {
|
|
|
32
32
|
SETTINGS_KEYS,
|
|
33
33
|
deleteSetting,
|
|
34
34
|
getSetting
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-JNSSFTVD.js";
|
|
36
36
|
import {
|
|
37
37
|
getProject
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-YQ3SOPBI.js";
|
|
39
39
|
import {
|
|
40
40
|
COMPACTION_PROMPT,
|
|
41
41
|
TurnMetrics,
|
|
42
42
|
buildBasePrompt,
|
|
43
|
-
buildSubAgentSystemPrompt,
|
|
44
43
|
buildTopLevelSystemPrompt,
|
|
45
44
|
computeEffectiveTools,
|
|
46
45
|
consumeStreamGenerator,
|
|
@@ -50,13 +49,13 @@ import {
|
|
|
50
49
|
createToolCallEvent,
|
|
51
50
|
createToolResultEvent,
|
|
52
51
|
streamLLMPure
|
|
53
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-OSMUHB5F.js";
|
|
54
53
|
import {
|
|
55
54
|
getCurrentContextWindowId,
|
|
56
55
|
getCurrentWindowMessageOptions,
|
|
57
56
|
getEventStore,
|
|
58
57
|
getRuntimeConfig
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-WTDCC4IP.js";
|
|
60
59
|
import {
|
|
61
60
|
buildContextMessagesFromEventHistory,
|
|
62
61
|
foldContextState,
|
|
@@ -2411,7 +2410,7 @@ function drainQueue(sessionManager, sessionId, append, onMessage) {
|
|
|
2411
2410
|
}
|
|
2412
2411
|
|
|
2413
2412
|
// src/server/chat/agent-loop.ts
|
|
2414
|
-
function emitPartialDoneEvents(_sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append) {
|
|
2413
|
+
function emitPartialDoneEvents(_sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append, agentType) {
|
|
2415
2414
|
const stats = turnMetrics.buildStats(statsIdentity, mode);
|
|
2416
2415
|
append(
|
|
2417
2416
|
createMessageDoneEvent(assistantMsgId, {
|
|
@@ -2419,9 +2418,9 @@ function emitPartialDoneEvents(_sessionId, assistantMsgId, statsIdentity, mode,
|
|
|
2419
2418
|
partial: true
|
|
2420
2419
|
})
|
|
2421
2420
|
);
|
|
2422
|
-
append(createChatDoneEvent(assistantMsgId, "stopped", stats));
|
|
2421
|
+
append(createChatDoneEvent(assistantMsgId, "stopped", stats, agentType));
|
|
2423
2422
|
}
|
|
2424
|
-
function emitDoneAndBreak(assistantMsgId, segments, statsIdentity, mode, turnMetrics, append, onMessage, reason) {
|
|
2423
|
+
function emitDoneAndBreak(assistantMsgId, segments, statsIdentity, mode, turnMetrics, append, onMessage, reason, agentType) {
|
|
2425
2424
|
const stats = turnMetrics.buildStats(statsIdentity, mode);
|
|
2426
2425
|
append(
|
|
2427
2426
|
createMessageDoneEvent(assistantMsgId, {
|
|
@@ -2429,7 +2428,7 @@ function emitDoneAndBreak(assistantMsgId, segments, statsIdentity, mode, turnMet
|
|
|
2429
2428
|
stats
|
|
2430
2429
|
})
|
|
2431
2430
|
);
|
|
2432
|
-
append(createChatDoneEvent(assistantMsgId, reason, stats));
|
|
2431
|
+
append(createChatDoneEvent(assistantMsgId, reason, stats, agentType));
|
|
2433
2432
|
if (onMessage) {
|
|
2434
2433
|
onMessage(
|
|
2435
2434
|
createChatMessageUpdatedMessage(assistantMsgId, {
|
|
@@ -2437,7 +2436,7 @@ function emitDoneAndBreak(assistantMsgId, segments, statsIdentity, mode, turnMet
|
|
|
2437
2436
|
stats
|
|
2438
2437
|
})
|
|
2439
2438
|
);
|
|
2440
|
-
onMessage(createChatDoneMessage(assistantMsgId, reason, stats));
|
|
2439
|
+
onMessage(createChatDoneMessage(assistantMsgId, reason, stats, agentType));
|
|
2441
2440
|
}
|
|
2442
2441
|
}
|
|
2443
2442
|
var MAX_TRUNCATION_RETRIES = 3;
|
|
@@ -2445,6 +2444,7 @@ var CONTINUE_PROMPT = "Continue your previous response. Do NOT repeat what you a
|
|
|
2445
2444
|
async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
2446
2445
|
const { mode, sessionManager, sessionId, llmClient, signal, onMessage, statsIdentity } = config;
|
|
2447
2446
|
const append = config.append;
|
|
2447
|
+
const agentType = config.subAgentMetadata ? "sub-agent" : void 0;
|
|
2448
2448
|
const retryLimiter = createRetryLimiter(config.maxRetriesPerTurn ?? 10);
|
|
2449
2449
|
let truncationRetryCount = 0;
|
|
2450
2450
|
let returnValueContent;
|
|
@@ -2490,7 +2490,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2490
2490
|
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
2491
2491
|
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
2492
2492
|
if (signal?.aborted) throw new Error("Aborted");
|
|
2493
|
-
const assembledRequest = config.assembleRequest({
|
|
2493
|
+
const assembledRequest = await config.assembleRequest({
|
|
2494
2494
|
workdir: session.workdir,
|
|
2495
2495
|
messages: requestMessages,
|
|
2496
2496
|
injectedFiles,
|
|
@@ -2535,7 +2535,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2535
2535
|
type: "chat.error",
|
|
2536
2536
|
data: { error: `Auto-retry limit exceeded after ${retryLimiter.maxRetries()} retries`, recoverable: false }
|
|
2537
2537
|
});
|
|
2538
|
-
append(createChatDoneEvent(assistantMsgId, "error"));
|
|
2538
|
+
append(createChatDoneEvent(assistantMsgId, "error", void 0, agentType));
|
|
2539
2539
|
throw new Error("Auto-retry limit exceeded");
|
|
2540
2540
|
}
|
|
2541
2541
|
retryLimiter.increment();
|
|
@@ -2568,7 +2568,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2568
2568
|
continue;
|
|
2569
2569
|
}
|
|
2570
2570
|
if (result.aborted) {
|
|
2571
|
-
emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append);
|
|
2571
|
+
emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append, agentType);
|
|
2572
2572
|
throw new Error("Aborted");
|
|
2573
2573
|
}
|
|
2574
2574
|
turnMetrics.addLLMCall(
|
|
@@ -2581,7 +2581,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2581
2581
|
sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
|
|
2582
2582
|
if (!compacting) {
|
|
2583
2583
|
const contextState2 = sessionManager.getContextState(sessionId);
|
|
2584
|
-
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-
|
|
2584
|
+
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-SHEOFZDB.js");
|
|
2585
2585
|
if (shouldCompact(contextState2.currentTokens, contextState2.maxTokens, runtimeConfig.context.compactionThreshold)) {
|
|
2586
2586
|
appendCompactionPrompt(sessionId, append);
|
|
2587
2587
|
compacting = true;
|
|
@@ -2627,7 +2627,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2627
2627
|
partial: true
|
|
2628
2628
|
})
|
|
2629
2629
|
);
|
|
2630
|
-
append(createChatDoneEvent(assistantMsgId, "truncated", stats2));
|
|
2630
|
+
append(createChatDoneEvent(assistantMsgId, "truncated", stats2, agentType));
|
|
2631
2631
|
break;
|
|
2632
2632
|
}
|
|
2633
2633
|
}
|
|
@@ -2684,7 +2684,8 @@ ${COMPACTION_PROMPT}`,
|
|
|
2684
2684
|
turnMetrics,
|
|
2685
2685
|
append,
|
|
2686
2686
|
onMessage,
|
|
2687
|
-
"step_done"
|
|
2687
|
+
"step_done",
|
|
2688
|
+
agentType
|
|
2688
2689
|
);
|
|
2689
2690
|
break;
|
|
2690
2691
|
}
|
|
@@ -2700,7 +2701,8 @@ ${COMPACTION_PROMPT}`,
|
|
|
2700
2701
|
turnMetrics,
|
|
2701
2702
|
append,
|
|
2702
2703
|
onMessage,
|
|
2703
|
-
"complete"
|
|
2704
|
+
"complete",
|
|
2705
|
+
agentType
|
|
2704
2706
|
);
|
|
2705
2707
|
break;
|
|
2706
2708
|
}
|
|
@@ -2710,13 +2712,13 @@ ${COMPACTION_PROMPT}`,
|
|
|
2710
2712
|
}
|
|
2711
2713
|
} catch (error) {
|
|
2712
2714
|
if (error instanceof Error && error.message === "Aborted") {
|
|
2713
|
-
emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append);
|
|
2715
|
+
emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append, agentType);
|
|
2714
2716
|
throw error;
|
|
2715
2717
|
}
|
|
2716
2718
|
throw error;
|
|
2717
2719
|
}
|
|
2718
2720
|
if (signal?.aborted) {
|
|
2719
|
-
emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append);
|
|
2721
|
+
emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, append, agentType);
|
|
2720
2722
|
throw new Error("Aborted");
|
|
2721
2723
|
}
|
|
2722
2724
|
void drainQueue(sessionManager, sessionId, append, onMessage);
|
|
@@ -2753,7 +2755,7 @@ ${COMPACTION_PROMPT}`,
|
|
|
2753
2755
|
}
|
|
2754
2756
|
});
|
|
2755
2757
|
append(createMessageDoneEvent(assistantMsgId, { stats: turnMetrics.buildStats(statsIdentity, mode) }));
|
|
2756
|
-
append(createChatDoneEvent(assistantMsgId, "complete"));
|
|
2758
|
+
append(createChatDoneEvent(assistantMsgId, "complete", void 0, agentType));
|
|
2757
2759
|
config.injectAgentReminder?.();
|
|
2758
2760
|
compacting = false;
|
|
2759
2761
|
if (config.initialCompacting) break;
|
|
@@ -2788,7 +2790,7 @@ ${COMPACTION_PROMPT}`,
|
|
|
2788
2790
|
stats
|
|
2789
2791
|
})
|
|
2790
2792
|
);
|
|
2791
|
-
append(createChatDoneEvent(assistantMsgId, "complete", stats));
|
|
2793
|
+
append(createChatDoneEvent(assistantMsgId, "complete", stats, agentType));
|
|
2792
2794
|
break;
|
|
2793
2795
|
}
|
|
2794
2796
|
return {
|
|
@@ -2833,32 +2835,6 @@ function createAssemblyResult(input) {
|
|
|
2833
2835
|
tools: input.requestTools
|
|
2834
2836
|
};
|
|
2835
2837
|
}
|
|
2836
|
-
function buildAssemblyInput(systemPrompt, baseInput) {
|
|
2837
|
-
return createAssemblyResult({
|
|
2838
|
-
systemPrompt,
|
|
2839
|
-
messages: baseInput.messages,
|
|
2840
|
-
injectedFiles: baseInput.injectedFiles,
|
|
2841
|
-
requestTools: baseInput.requestTools ?? baseInput.promptTools,
|
|
2842
|
-
toolChoice: baseInput.toolChoice ?? "auto",
|
|
2843
|
-
...baseInput.customInstructions ? { customInstructions: baseInput.customInstructions } : {},
|
|
2844
|
-
...baseInput.skills && baseInput.skills.length > 0 ? { skills: baseInput.skills } : {}
|
|
2845
|
-
});
|
|
2846
|
-
}
|
|
2847
|
-
function assembleAgentRequest(input) {
|
|
2848
|
-
const { agentDef, subAgentDefs, ...baseInput } = input;
|
|
2849
|
-
if (agentDef.metadata.subagent) {
|
|
2850
|
-
const systemPrompt2 = buildSubAgentSystemPrompt(baseInput.workdir, agentDef, baseInput.skills, baseInput.modelName);
|
|
2851
|
-
return buildAssemblyInput(systemPrompt2, baseInput);
|
|
2852
|
-
}
|
|
2853
|
-
const systemPrompt = buildTopLevelSystemPrompt(
|
|
2854
|
-
baseInput.workdir,
|
|
2855
|
-
baseInput.customInstructions,
|
|
2856
|
-
baseInput.skills,
|
|
2857
|
-
subAgentDefs,
|
|
2858
|
-
baseInput.modelName
|
|
2859
|
-
);
|
|
2860
|
-
return buildAssemblyInput(systemPrompt, baseInput);
|
|
2861
|
-
}
|
|
2862
2838
|
|
|
2863
2839
|
// src/server/llm/vision-fallback.ts
|
|
2864
2840
|
var IMAGE_PROMPT = `Describe this image in detail. Focus on:
|
|
@@ -3290,7 +3266,7 @@ async function executeSubAgent(options) {
|
|
|
3290
3266
|
statsIdentity,
|
|
3291
3267
|
signal,
|
|
3292
3268
|
onMessage,
|
|
3293
|
-
assembleRequest: (input) => createAssemblyResult({
|
|
3269
|
+
assembleRequest: async (input) => createAssemblyResult({
|
|
3294
3270
|
systemPrompt,
|
|
3295
3271
|
messages: input.messages,
|
|
3296
3272
|
injectedFiles: input.injectedFiles,
|
|
@@ -3386,7 +3362,7 @@ var callSubAgentTool = {
|
|
|
3386
3362
|
};
|
|
3387
3363
|
}
|
|
3388
3364
|
try {
|
|
3389
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3365
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-2QBZBNDL.js");
|
|
3390
3366
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3391
3367
|
const turnMetrics = new TurnMetrics();
|
|
3392
3368
|
const result = await executeSubAgent({
|
|
@@ -4186,32 +4162,49 @@ function computeDynamicContextHash(instructionContent, skills, toolFingerprint)
|
|
|
4186
4162
|
function getToolFingerprint(tools) {
|
|
4187
4163
|
return tools.map((t) => `${t.function.name}:${JSON.stringify(t.function.parameters)}`).sort().join("|");
|
|
4188
4164
|
}
|
|
4189
|
-
async function
|
|
4165
|
+
async function loadSessionContext(sessionManager, sessionId) {
|
|
4190
4166
|
const session = sessionManager.requireSession(sessionId);
|
|
4191
4167
|
const { content: instructionContent } = await getAllInstructions(session.workdir, session.projectId);
|
|
4192
4168
|
const runtimeConfig = getRuntimeConfig();
|
|
4193
4169
|
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
4194
4170
|
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4171
|
+
return { instructionContent: instructionContent ?? "", skills };
|
|
4172
|
+
}
|
|
4173
|
+
function resolveAgentDef2(sessionManager, sessionId) {
|
|
4174
|
+
return loadAllAgentsDefault().then((allAgents) => {
|
|
4175
|
+
const session = sessionManager.requireSession(sessionId);
|
|
4176
|
+
return findAgentById(session.mode, allAgents) ?? findAgentById("planner", allAgents);
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
4180
|
+
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4181
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-2QBZBNDL.js");
|
|
4182
|
+
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4183
|
+
const toolFingerprint = getToolFingerprint(tools);
|
|
4184
|
+
const allAgents = await loadAllAgentsDefault();
|
|
4185
|
+
const subAgentDefs = getSubAgents(allAgents);
|
|
4186
|
+
const session = sessionManager.requireSession(sessionId);
|
|
4187
|
+
const systemPrompt = buildTopLevelSystemPrompt(session.workdir, instructionContent || void 0, skills, subAgentDefs);
|
|
4198
4188
|
const hash = computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
4199
|
-
return {
|
|
4189
|
+
return { systemPrompt, tools, hash };
|
|
4190
|
+
}
|
|
4191
|
+
async function computeSessionHash(sessionManager, sessionId) {
|
|
4192
|
+
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4193
|
+
const agentDef = await resolveAgentDef2(sessionManager, sessionId);
|
|
4194
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-2QBZBNDL.js");
|
|
4195
|
+
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4196
|
+
const toolFingerprint = getToolFingerprint(tools);
|
|
4197
|
+
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
4200
4198
|
}
|
|
4201
4199
|
async function applyDynamicContext(sessionManager, sessionId) {
|
|
4202
|
-
const
|
|
4200
|
+
const session = sessionManager.requireSession(sessionId);
|
|
4203
4201
|
const allAgents = await loadAllAgentsDefault();
|
|
4204
|
-
const
|
|
4205
|
-
const systemPrompt =
|
|
4206
|
-
|
|
4207
|
-
instructionContent || void 0,
|
|
4208
|
-
skills,
|
|
4209
|
-
subAgentDefs
|
|
4210
|
-
);
|
|
4211
|
-
sessionManager.setCachedPrompt(sessionId, systemPrompt, allTools, hash);
|
|
4202
|
+
const agentDef = findAgentById(session.mode, allAgents) ?? findAgentById("planner", allAgents);
|
|
4203
|
+
const { systemPrompt, tools, hash } = await buildCachedPrompt(sessionManager, sessionId, agentDef);
|
|
4204
|
+
sessionManager.setCachedPrompt(sessionId, systemPrompt, tools, hash);
|
|
4212
4205
|
sessionManager.setDynamicContextChanged(sessionId, false);
|
|
4213
4206
|
sessionManager.clearDebugDump(sessionId);
|
|
4214
|
-
logger.debug("applyDynamicContext done", { sessionId, hash, toolCount:
|
|
4207
|
+
logger.debug("applyDynamicContext done", { sessionId, hash, toolCount: tools.length });
|
|
4215
4208
|
}
|
|
4216
4209
|
|
|
4217
4210
|
// src/server/tools/mcp-config.ts
|
|
@@ -4305,7 +4298,7 @@ var mcpConfigTool = createTool(
|
|
|
4305
4298
|
await saveGlobalConfig(mcpConfigMode, { ...globalConfig, mcpServers: updated });
|
|
4306
4299
|
}
|
|
4307
4300
|
async function rebuildTools() {
|
|
4308
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4301
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-2QBZBNDL.js");
|
|
4309
4302
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
4310
4303
|
setMcpTools2(mcpTools);
|
|
4311
4304
|
}
|
|
@@ -4666,7 +4659,6 @@ export {
|
|
|
4666
4659
|
getDefaultAgentIds,
|
|
4667
4660
|
isDefaultAgent,
|
|
4668
4661
|
findAgentById,
|
|
4669
|
-
getSubAgents,
|
|
4670
4662
|
getTopLevelAgents,
|
|
4671
4663
|
agentExists,
|
|
4672
4664
|
saveAgent,
|
|
@@ -4688,7 +4680,6 @@ export {
|
|
|
4688
4680
|
deleteProjectSkill,
|
|
4689
4681
|
runTopLevelAgentLoop,
|
|
4690
4682
|
createAssemblyResult,
|
|
4691
|
-
assembleAgentRequest,
|
|
4692
4683
|
getConversationMessages,
|
|
4693
4684
|
processEventsForConversation,
|
|
4694
4685
|
executeSubAgent,
|
|
@@ -4696,6 +4687,8 @@ export {
|
|
|
4696
4687
|
stepDoneTool,
|
|
4697
4688
|
computeDynamicContextHash,
|
|
4698
4689
|
getToolFingerprint,
|
|
4690
|
+
buildCachedPrompt,
|
|
4691
|
+
computeSessionHash,
|
|
4699
4692
|
applyDynamicContext,
|
|
4700
4693
|
setMcpManagerForTools,
|
|
4701
4694
|
setMcpConfigMode,
|
|
@@ -4709,4 +4702,4 @@ export {
|
|
|
4709
4702
|
getToolRegistryForAgent,
|
|
4710
4703
|
createToolRegistry
|
|
4711
4704
|
};
|
|
4712
|
-
//# sourceMappingURL=chunk-
|
|
4705
|
+
//# sourceMappingURL=chunk-XJU2PBLN.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDatabase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZPIZLTWU.js";
|
|
4
4
|
|
|
5
5
|
// src/server/db/projects.ts
|
|
6
6
|
function createProject(name, workdir) {
|
|
@@ -117,4 +117,4 @@ export {
|
|
|
117
117
|
deleteProject,
|
|
118
118
|
toggleStar
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-YQ3SOPBI.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
COMPACTION_PROMPT,
|
|
3
3
|
createMessageStartEvent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OSMUHB5F.js";
|
|
5
5
|
import {
|
|
6
6
|
getCurrentWindowMessageOptions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WTDCC4IP.js";
|
|
8
8
|
|
|
9
9
|
// src/server/context/compactor.ts
|
|
10
10
|
function appendCompactionPrompt(sessionId, append) {
|
|
@@ -31,4 +31,4 @@ export {
|
|
|
31
31
|
shouldCompact,
|
|
32
32
|
getCompactionTarget
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-ZMONCXGW.js.map
|
|
@@ -161,6 +161,18 @@ function runMigrations(db2) {
|
|
|
161
161
|
).run();
|
|
162
162
|
logger.info("Backfilled message counts", { count: backfillResult.changes });
|
|
163
163
|
}
|
|
164
|
+
if (!columnNames.includes("cached_system_prompt")) {
|
|
165
|
+
logger.info("Migrating sessions table: adding cached_system_prompt column");
|
|
166
|
+
db2.exec(`ALTER TABLE sessions ADD COLUMN cached_system_prompt TEXT`);
|
|
167
|
+
}
|
|
168
|
+
if (!columnNames.includes("cached_tools")) {
|
|
169
|
+
logger.info("Migrating sessions table: adding cached_tools column");
|
|
170
|
+
db2.exec(`ALTER TABLE sessions ADD COLUMN cached_tools TEXT`);
|
|
171
|
+
}
|
|
172
|
+
if (!columnNames.includes("cached_hash")) {
|
|
173
|
+
logger.info("Migrating sessions table: adding cached_hash column");
|
|
174
|
+
db2.exec(`ALTER TABLE sessions ADD COLUMN cached_hash TEXT`);
|
|
175
|
+
}
|
|
164
176
|
logger.info("Database migrations completed");
|
|
165
177
|
}
|
|
166
178
|
|
|
@@ -168,4 +180,4 @@ export {
|
|
|
168
180
|
initDatabase,
|
|
169
181
|
getDatabase
|
|
170
182
|
};
|
|
171
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-ZPIZLTWU.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
appendCompactionPrompt,
|
|
3
3
|
getCompactionTarget,
|
|
4
4
|
shouldCompact
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ZMONCXGW.js";
|
|
6
|
+
import "./chunk-OSMUHB5F.js";
|
|
7
|
+
import "./chunk-WTDCC4IP.js";
|
|
8
8
|
import "./chunk-6PLAWCHQ.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ZPIZLTWU.js";
|
|
10
10
|
import "./chunk-J2GP3J3X.js";
|
|
11
11
|
import "./chunk-Z4FMBCJO.js";
|
|
12
12
|
import "./chunk-ZJ4FP6RS.js";
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
getCompactionTarget,
|
|
18
18
|
shouldCompact
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=compactor-
|
|
20
|
+
//# sourceMappingURL=compactor-SHEOFZDB.js.map
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
isStoredEvent,
|
|
39
39
|
isTurnEvent,
|
|
40
40
|
truncateSessionMessages
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-WTDCC4IP.js";
|
|
42
42
|
import {
|
|
43
43
|
buildContextMessagesFromEventHistory,
|
|
44
44
|
buildContextMessagesFromMessages,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
foldTurnEventsToSnapshotMessages,
|
|
57
57
|
getMessagesForWindow
|
|
58
58
|
} from "./chunk-6PLAWCHQ.js";
|
|
59
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-ZPIZLTWU.js";
|
|
60
60
|
import "./chunk-K44MW7JJ.js";
|
|
61
61
|
export {
|
|
62
62
|
EventStore,
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
isTurnEvent,
|
|
115
115
|
truncateSessionMessages
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=events-
|
|
117
|
+
//# sourceMappingURL=events-YLICLPBY.js.map
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-EB2RIVZA.js";
|
|
6
|
+
import "./chunk-XJU2PBLN.js";
|
|
7
7
|
import "./chunk-DL6ZILAF.js";
|
|
8
8
|
import "./chunk-PBGOZMVY.js";
|
|
9
9
|
import "./chunk-VRGRAQDG.js";
|
|
10
10
|
import "./chunk-NWO6GRYE.js";
|
|
11
11
|
import "./chunk-F4PMNP7S.js";
|
|
12
12
|
import "./chunk-EU3WWTFH.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-JNSSFTVD.js";
|
|
14
|
+
import "./chunk-YQ3SOPBI.js";
|
|
15
15
|
import {
|
|
16
16
|
TurnMetrics,
|
|
17
17
|
createChatDoneEvent,
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
createMessageStartEvent,
|
|
20
20
|
createToolCallEvent,
|
|
21
21
|
createToolResultEvent
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-OSMUHB5F.js";
|
|
23
|
+
import "./chunk-WTDCC4IP.js";
|
|
24
24
|
import "./chunk-6PLAWCHQ.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-ZPIZLTWU.js";
|
|
26
26
|
import "./chunk-J2GP3J3X.js";
|
|
27
27
|
import "./chunk-Z4FMBCJO.js";
|
|
28
28
|
import "./chunk-ZJ4FP6RS.js";
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
runAgentTurn,
|
|
43
43
|
runChatTurn
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=orchestrator-
|
|
45
|
+
//# sourceMappingURL=orchestrator-YJV4CXKV.js.map
|
package/dist/package.json
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
buildRunChatTurnParams,
|
|
3
3
|
finalizeTurnCompletion,
|
|
4
4
|
generateSessionNameForSession
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-BGCDJYNU.js";
|
|
6
|
+
import "./chunk-XJU2PBLN.js";
|
|
7
7
|
import "./chunk-DL6ZILAF.js";
|
|
8
8
|
import "./chunk-PBGOZMVY.js";
|
|
9
9
|
import "./chunk-VRGRAQDG.js";
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
createSessionRunningMessage
|
|
14
14
|
} from "./chunk-F4PMNP7S.js";
|
|
15
15
|
import "./chunk-EU3WWTFH.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-JNSSFTVD.js";
|
|
17
|
+
import "./chunk-YQ3SOPBI.js";
|
|
18
|
+
import "./chunk-OSMUHB5F.js";
|
|
19
19
|
import {
|
|
20
20
|
getEventStore
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-WTDCC4IP.js";
|
|
22
22
|
import "./chunk-6PLAWCHQ.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-ZPIZLTWU.js";
|
|
24
24
|
import "./chunk-J2GP3J3X.js";
|
|
25
25
|
import "./chunk-Z4FMBCJO.js";
|
|
26
26
|
import "./chunk-ZJ4FP6RS.js";
|
|
@@ -171,7 +171,7 @@ var QueueProcessor = class {
|
|
|
171
171
|
backend: provider?.backend ?? llmClient.getBackend(),
|
|
172
172
|
model: llmClient.getModel()
|
|
173
173
|
};
|
|
174
|
-
const { runChatTurn } = await import("./orchestrator-
|
|
174
|
+
const { runChatTurn } = await import("./orchestrator-YJV4CXKV.js");
|
|
175
175
|
const runChatTurnParams = buildRunChatTurnParams({
|
|
176
176
|
sessionManager,
|
|
177
177
|
sessionId,
|
|
@@ -216,4 +216,4 @@ var QueueProcessor = class {
|
|
|
216
216
|
export {
|
|
217
217
|
QueueProcessor
|
|
218
218
|
};
|
|
219
|
-
//# sourceMappingURL=processor-
|
|
219
|
+
//# sourceMappingURL=processor-VGVPSVGE.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProject
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-YQ3SOPBI.js";
|
|
4
|
+
import "./chunk-ZPIZLTWU.js";
|
|
5
5
|
import "./chunk-K44MW7JJ.js";
|
|
6
6
|
|
|
7
7
|
// src/server/utils/project-creator.ts
|
|
@@ -108,4 +108,4 @@ export {
|
|
|
108
108
|
createDirectoryWithGit,
|
|
109
109
|
validateProjectName
|
|
110
110
|
};
|
|
111
|
-
//# sourceMappingURL=project-creator-
|
|
111
|
+
//# sourceMappingURL=project-creator-W6Z7KCMZ.js.map
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
listProjects,
|
|
7
7
|
toggleStar,
|
|
8
8
|
updateProject
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-YQ3SOPBI.js";
|
|
10
|
+
import "./chunk-ZPIZLTWU.js";
|
|
11
11
|
import "./chunk-K44MW7JJ.js";
|
|
12
12
|
export {
|
|
13
13
|
createProject,
|
|
@@ -18,4 +18,4 @@ export {
|
|
|
18
18
|
toggleStar,
|
|
19
19
|
updateProject
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=projects-
|
|
21
|
+
//# sourceMappingURL=projects-2XSGA7JG.js.map
|